Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
Continued implementation of the menu. Started fixing the schedule bug…
Browse files Browse the repository at this point in the history
… in the rule creator.
  • Loading branch information
Hyrules committed Feb 2, 2018
1 parent f7eaa74 commit be10b10
Show file tree
Hide file tree
Showing 25 changed files with 329 additions and 17,672 deletions.
2 changes: 1 addition & 1 deletion HueLib2Test/Properties/AssemblyInfo.cs
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.88.0")]
[assembly: AssemblyVersion("1.0.98.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
5 changes: 0 additions & 5 deletions WinHue3/App.xaml
Expand Up @@ -4,11 +4,6 @@
Startup="Application_Startup" >
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--Attach Default Fluent Control's Theme-->
<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Generic.xaml" />

</ResourceDictionary.MergedDictionaries>
<Style x:Key="AnimatedSwitch" TargetType="{x:Type ToggleButton}">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="#FAFAFB" />
Expand Down
63 changes: 38 additions & 25 deletions WinHue3/Functions/Advanced Creator/Form_AdvancedCreator.xaml
Expand Up @@ -10,46 +10,59 @@
xmlns:controls="clr-namespace:WinHue3.Controls"
xmlns:comm="clr-namespace:WinHue3.Philips_Hue.Communication"
xmlns:advancedCreator="clr-namespace:WinHue3.Functions.Advanced_Creator"
xmlns:fluent="clr-namespace:Fluent;assembly=Fluent"
mc:Ignorable="d"
Title="{x:Static resx:GUI.MainForm_Tab_Home_Group_Creators_AdvancedCreator}" Height="600" Width="800" ResizeMode="CanResizeWithGrip" MinHeight="600" MinWidth="800" Icon="/WinHue3;component/Resources/advanced.png" WindowStartupLocation="CenterOwner" Name="Window">
<Window.DataContext>
<advancedCreator:AdvancedCreatorViewModel/>
</Window.DataContext>
<Grid x:Name="DockPanel">
<fluent:Ribbon x:Name="Ribbon" Width="auto" CanMinimize="False">
<fluent:RibbonTabItem Header="{x:Static resx:GUI.Form_AdvancedCreator_Templates}" >
<fluent:RibbonGroupBox Header="{x:Static resx:GUI.Form_AdvancedCreator_Templates}">
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_RuleTemplate}" LargeImageSource="/WinHue3;component/Resources/rules.png" Command="{Binding CreateRuleTemplateCommand}" />
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_SensorTemplate}" LargeImageSource="/WinHue3;component/Resources/sensor.png" Command="{Binding CreateSensorTemplateCommand}" />
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_ResourceLinkTemplate}" LargeImageSource="/WinHue3;component/Resources/resource.png" Command="{Binding CreateResourceLinkTemplateCommand }" />
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_GroupTemplate}" LargeImageSource="/WinHue3;component/Resources/HueGroupOn.png" Command="{Binding CreateGroupTemplateCommand}" />
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_ScheduleTemplate}" LargeImageSource="/WinHue3;component/Resources/SchedulesLarge.png" Command="{Binding CreateScheduleTemplateCommand}" />
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_SceneTemplate}" LargeImageSource="/WinHue3;component/Resources/scenes.png" Command="{Binding CreateSceneTemplateCommand}" />
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_SceneLightTemplate}" LargeImageSource="/WinHue3;component/Resources/scenes.png" Command="{Binding CreateSceneStateCommand}" />
</fluent:RibbonGroupBox>
<fluent:RibbonGroupBox Header="{x:Static resx:GUI.Form_AdvancedCreator_Actions}">
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_Clear}" LargeImageSource="/WinHue3;component/Resources/1493782199_draft.png" Command="{Binding ClearTemplateCommand}"/>
<RibbonButton Label="{x:Static resx:GUI.Form_AdvancedCreator_Send}" LargeImageSource="/WinHue3;component/Resources/bridge.png" Command="{Binding SendCommand}" />
</fluent:RibbonGroupBox>

</fluent:RibbonTabItem>

</fluent:Ribbon>
<Button Margin="0,118,0,0" Command="{Binding SetBridgeUrlCommand}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" Width="29" Height="29" VerticalAlignment="Top">
<ToolBarTray>
<ToolBar Header="{x:Static resx:GUI.Form_AdvancedCreator_Templates}">
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_RuleTemplate}" Command="{Binding CreateRuleTemplateCommand}" >
<Image Source="/WinHue3;component/Resources/rules.png" Height="32"/>
</Button>
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_SensorTemplate}" Command="{Binding CreateSensorTemplateCommand}">
<Image Source="/WinHue3;component/Resources/sensor.png" Height="32"/>
</Button>
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_ResourceLinkTemplate}" Command="{Binding CreateResourceLinkTemplateCommand }" >
<Image Source="/WinHue3;component/Resources/resource.png" Height="32"/>
</Button>
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_GroupTemplate}" Command="{Binding CreateGroupTemplateCommand}">
<Image Source="/WinHue3;component/Resources/HueGroupOn.png" Height="32"/>
</Button>
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_ScheduleTemplate}" Command="{Binding CreateScheduleTemplateCommand}">
<Image Source="/WinHue3;component/Resources/SchedulesLarge.png" Height="32"/>
</Button>
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_SceneTemplate}" Command="{Binding CreateSceneTemplateCommand}">
<Image Source="/WinHue3;component/Resources/scenes.png" Height="32"/>
</Button>
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_SceneLightTemplate}" Command="{Binding CreateSceneStateCommand}">
<Image Source="/WinHue3;component/Resources/scenes.png" Height="32"/>
</Button>
</ToolBar>
<ToolBar Header="{x:Static resx:GUI.Form_AdvancedCreator_Actions}">
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_Clear}" Command="{Binding ClearTemplateCommand}">
<Image Source="/WinHue3;component/Resources/1493782199_draft.png" Height="32"/>
</Button>
<Button ToolTip="{x:Static resx:GUI.Form_AdvancedCreator_Send}" Command="{Binding SendCommand}">
<Image Source="/WinHue3;component/Resources/bridge.png" Height="32"/>
</Button>
</ToolBar>
</ToolBarTray>
<Button Margin="0,46,0,0" Command="{Binding SetBridgeUrlCommand}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" Width="29" Height="29" VerticalAlignment="Top">
<Button.Content>
<Image Source="/WinHue3;component/Resources/bridge.png" HorizontalAlignment="Left" Width="22" Margin="-4,-4,0,-0.333" Height="23" VerticalAlignment="Top"/>
<Image Source="/WinHue3;component/Resources/bridge.png" HorizontalAlignment="Left" Width="22" Margin="0,0,0,-0.333" Height="23" VerticalAlignment="Top"/>
</Button.Content>
</Button>

<xctk:WatermarkTextBox TextWrapping="Wrap" Height="28" Text="{Binding Url, UpdateSourceTrigger=PropertyChanged}" Margin="30,118,97.333,0" VerticalAlignment="Top" Watermark="{x:Static resx:GUI.Form_AdvancedCreator_UrlWatermark}" />
<ComboBox Margin="0,118,0.333,0" Height="28" VerticalAlignment="Top" HorizontalAlignment="Right" Width="100" SelectedValue="{Binding RequestType}" SelectedValuePath="Content">
<xctk:WatermarkTextBox TextWrapping="Wrap" Height="28" Text="{Binding Url, UpdateSourceTrigger=PropertyChanged}" Margin="30,46,97,0" VerticalAlignment="Top" Watermark="{x:Static resx:GUI.Form_AdvancedCreator_UrlWatermark}" />
<ComboBox Margin="0,46,0,0" Height="28" VerticalAlignment="Top" HorizontalAlignment="Right" Width="100" SelectedValue="{Binding RequestType}" SelectedValuePath="Content">
<ComboBoxItem Content="POST" Tag="{x:Static comm:WebRequestType.Post}"/>
<ComboBoxItem Content="PUT" Tag="{x:Static comm:WebRequestType.Put}"/>
<ComboBoxItem Content="DELETE" Tag="{x:Static comm:WebRequestType.Delete}"/>
<ComboBoxItem Content="GET" Tag="{x:Static comm:WebRequestType.Get}"/>
</ComboBox>
<avalonedit:TextEditor ShowLineNumbers="True" Margin="0,146,0.333,19.667" >
<avalonedit:TextEditor ShowLineNumbers="True" Margin="0,80,0,20" >
<i:Interaction.Behaviors>
<controls:AvalonEditBehaviour EditorText="{Binding Text,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</i:Interaction.Behaviors>
Expand Down
16 changes: 8 additions & 8 deletions WinHue3/Functions/Rules/Creator/Form_RuleCreator.xaml
Expand Up @@ -179,7 +179,7 @@
</xctk:PropertyGrid.EditorDefinitions>-->
</xctk:PropertyGrid>
<Button Content="{x:Static resx:GUI.RuleCreatorForm_AddToRuleActions}" HorizontalAlignment="Left" Margin="10,281,0,0" VerticalAlignment="Top" Width="342" Command="{Binding Action_AddActionCommand}" Height="30"/>
<controls:CommandComboBox HorizontalAlignment="Left" Margin="160,7,0,0" VerticalAlignment="Top" Width="192" ItemsSource="{Binding ListHueObjects}" SelectedItem="{Binding SelectedHueObject}" Command="{Binding Action_SelectActionObjectCommand}" Watermark="Object" Height="27" Style="{StaticResource {x:Type ComboBox}}">
<controls:CommandComboBox HorizontalAlignment="Left" Margin="160,7,0,0" VerticalAlignment="Top" Width="192" ItemsSource="{Binding ListHueObjects}" SelectedItem="{Binding SelectedHueObject}" Command="{Binding Action_SelectActionObjectCommand}" Watermark="Object" Height="23" Style="{StaticResource {x:Type ComboBox}}">
<ComboBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
Expand All @@ -190,17 +190,17 @@
</DataTemplate>
</ComboBox.ItemTemplate>
</controls:CommandComboBox>
<controls:CommandComboBox HorizontalAlignment="Left" Margin="10,7,0,0" VerticalAlignment="Top" Width="145" SelectedValuePath="Tag" SelectedValue="{Binding SelectedHueObjectType}" Command="{Binding Action_SelectHueObjectTypeCommand}" Watermark="Object Type" Style="{StaticResource {x:Type ComboBox}}">
<ComboBoxItem Content="Lights" Tag="{x:Type light:Light}"/>
<ComboBoxItem Content="Groups" Tag="{x:Type group:Group}"/>
<ComboBoxItem Content="Scenes" Tag="{x:Type scene:Scene}"/>
<ComboBoxItem Content="Sensors" Tag="{x:Type sensor:Sensor}"/>

<controls:CommandComboBox HorizontalAlignment="Left" Margin="10,7,0,0" VerticalAlignment="Top" Width="145" SelectedValuePath="Tag" SelectedValue="{Binding SelectedHueObjectType}" Command="{Binding Action_SelectHueObjectTypeCommand}" Watermark="Object Type" Style="{StaticResource {x:Type ComboBox}}" Height="23">
<ComboBoxItem Content="{x:Static resx:GUI.ListView_lights}" Tag="{x:Type light:Light}"/>
<ComboBoxItem Content="{x:Static resx:GUI.ListView_groups}" Tag="{x:Type group:Group}"/>
<ComboBoxItem Content="{x:Static resx:GUI.ListView_scenes}" Tag="{x:Type scene:Scene}"/>
<ComboBoxItem Content="{x:Static resx:GUI.ListView_sensors}" Tag="{x:Type sensor:Sensor}"/>
<ComboBoxItem Content="{x:Static resx:GUI.ListView_schedules}" Tag="{x:Type schedule:Schedule}"/>
</controls:CommandComboBox>
<Button Content="{x:Static resx:GUI.RuleCreatorForm_Actions_MoveUp}" HorizontalAlignment="Left" Margin="447,281,0,0" VerticalAlignment="Top" Width="75" Height="30" Command="{Binding Action_MoveUpRuleActionCommand}"/>
<Button Content="{x:Static resx:GUI.RuleCreatorForm_Actions_MoveDown}" HorizontalAlignment="Left" Margin="527,282,0,0" VerticalAlignment="Top" Width="85" Height="29" Command="{Binding Action_MoveDownRuleActionCommand}"/>
<Button Content="{x:Static resx:GUI.RuleCreatorForm_Actions_Delete}" HorizontalAlignment="Left" Margin="617,281,0,0" VerticalAlignment="Top" Width="75" Height="30" Command="{Binding Action_RemoveRuleActionCommand}" Background="Red"/>
<Button Content="{x:Static resx:GUI.RuleCreatorForm_Actions_Clear}" HorizontalAlignment="Left" Margin="357,282,0,0" VerticalAlignment="Top" Width="85" Command="{Binding Action_ClearRuleActionCommand}"/>
<Button Content="{x:Static resx:GUI.RuleCreatorForm_Actions_Clear}" HorizontalAlignment="Left" Margin="357,282,0,0" VerticalAlignment="Top" Width="85" Command="{Binding Action_ClearRuleActionCommand}" Height="29"/>

</Grid>
</TabItem>
Expand Down
14 changes: 14 additions & 0 deletions WinHue3/Functions/Rules/Creator/RuleCreatorViewModel.cs
Expand Up @@ -231,6 +231,9 @@ private void SelectHueObjectType()
case Type scene when scene == typeof(Scene):
ListHueObjects = _listAvailableHueObject.OfType<Scene>().ToList<IHueObject>();

break;
case Type schedule when schedule == typeof(Schedule):
ListHueObjects = _listAvailableHueObject.OfType<Schedule>().ToList<IHueObject>();
break;
default:
ListHueObjects = null;
Expand Down Expand Up @@ -304,6 +307,17 @@ private void SelectRuleAction()
MessageBox.Show(GlobalStrings.Rule_SelectedObjectDoesNotExists, GlobalStrings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
break;
case "schedules":
SelectedHueObjectType = typeof(Schedule);
if(_listHueObjects.Exists(x => x.Id == ha.id))
{
SelectedHueObject = _listHueObjects.Find(x => x.Id == ha.id);
}
else
{
MessageBox.Show(GlobalStrings.Rule_SelectedObjectDoesNotExists, GlobalStrings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
break;
default:
MessageBox.Show(GlobalStrings.Rule, GlobalStrings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
break;
Expand Down

0 comments on commit be10b10

Please sign in to comment.