diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-10-29 15:55:21 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-10-29 15:55:21 +0200 |
| commit | 4b789f33eadfc5cc1d937a80ce03ea8425955ffe (patch) | |
| tree | 7dbbd0529a24f9ca064cab688a0d6d2b8b762ea1 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common | |
| parent | 8f3baa0d9097aa6ed800863a4680608e867c809a (diff) | |
| parent | 11fb700fcbc4627162a9c3f84b03b5016248bd97 (diff) | |
| download | Tango-4b789f33eadfc5cc1d937a80ce03ea8425955ffe.tar.gz Tango-4b789f33eadfc5cc1d937a80ce03ea8425955ffe.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common')
5 files changed, 186 insertions, 48 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs index f1a205f5d..89b8920d9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs @@ -29,6 +29,7 @@ namespace Tango.MachineStudio.Common.EventLogging public class DefaultEventLogger : ExtendedObject, IEventLogger { private ObservablesContext _db; + private static object _lockInit = new object(); private Thread _logThread; private ConcurrentQueue<MachinesEvent> _events; private IStudioApplicationManager _application; @@ -89,24 +90,27 @@ namespace Tango.MachineStudio.Common.EventLogging private void Init() { - if (!_isInitialized) + lock (_lockInit) { - try + if (!_isInitialized) { - _db = ObservablesContext.CreateDefault(); + try + { + _db = ObservablesContext.CreateDefault(); - _db.EventTypes.ToList(); + _db.EventTypes.ToList(); - foreach (var type in _db.EventTypes) + foreach (var type in _db.EventTypes) + { + _eventTypesGuids.Add((EventTypes)type.Code, type); + } + + _isInitialized = true; + } + catch { - _eventTypesGuids.Add((EventTypes)type.Code, type); + _isInitialized = false; } - - _isInitialized = true; - } - catch - { - _isInitialized = false; } } } @@ -194,10 +198,10 @@ namespace Tango.MachineStudio.Common.EventLogging /// <param name="events">The events.</param> private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> events) { - foreach (var ev in events) - { - Log(String.Format("Event '{0}' resolved.", ev.EventType.Name)); - } + //foreach (var ev in events) + //{ + // Log(String.Format("Event '{0}' resolved.", ev.EventType.Name)); + //} } #endregion @@ -210,6 +214,8 @@ namespace Tango.MachineStudio.Common.EventLogging /// <param name="machineEvent">The machine event.</param> public void Log(MachinesEvent machineEvent) { + Init(); + machineEvent.HostName = _hostName; machineEvent.EventType = _eventTypesGuids[machineEvent.Type]; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs index 92326f26f..b8e82cc2b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs @@ -12,6 +12,7 @@ using Tango.AdvancedInstaller; using Tango.Core; using Tango.Core.Cryptography; using Tango.Core.Helpers; +using Tango.Git; using Tango.MachineStudio.Common.Web; using Tango.Transport.Web; using Tango.Web; @@ -164,6 +165,40 @@ namespace Tango.MachineStudio.Common.Publish throw new InvalidOperationException($"The local version '{local_version}' is not greater than the remote version '{remote_version}'."); } + if (Options.CreateTag) + { + String repoPath = Path.GetFullPath("../../../../../"); + using (GitRepositoryManager git = new GitRepositoryManager(repoPath, Options.Email, Options.PersonalAccessToken)) + { + OnPublishProgress(0, 100, "Checking repository changes..."); + int changes = git.GetChanges().Count; + if (changes > 0) + { + throw new InvalidOperationException($"There are {changes} uncommitted changes on the repository. Please commit and push all changes before creating the Tag"); + } + + OnPublishProgress(0, 100, "Checking outgoing commits..."); + int commits = git.GetOutgoingCommits().Count; + if (commits > 0) + { + throw new InvalidOperationException($"There are {commits} outgoing commits on the repository. Please push all commits before creating the Tag"); + } + + String tagVersion = System.Version.Parse(GetLocalVersion()).ToString(3); + String tagName = $"Machine_Studio_v{tagVersion}"; + String tagDescription = $"Snapshot of Machine Studio v{tagVersion}"; + + git.Progress += (x, e) => + { + OnPublishProgress(e.Progress.Value, e.Progress.Maximum, $"Pushing Tag '{tagName}'..."); + }; + + OnPublishProgress(0, 100, $"Creating Tag '{tagName}'..."); + + git.CreatePushTag(tagName, tagDescription, "Roy Ben Shabat"); + } + } + OnPublishProgress(0, 100, $"Requesting version upload..."); var response = _client.UploadVersion(new UploadVersionRequest() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs index c5db355b1..80ca01149 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs @@ -81,6 +81,20 @@ namespace Tango.MachineStudio.Common.Publish set { _installerOutputFolder = value; RaisePropertyChangedAuto(); } } + private String _personalAccessToken; + public String PersonalAccessToken + { + get { return _personalAccessToken; } + set { _personalAccessToken = value; RaisePropertyChangedAuto(); } + } + + private bool _createTag; + public bool CreateTag + { + get { return _createTag; } + set { _createTag = value; RaisePropertyChangedAuto(); } + } + public PublishOptions() { BasePath = AppDomain.CurrentDomain.BaseDirectory + "..\\"; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index 37e35b1ab..d8e2017ec 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -4,12 +4,13 @@ xmlns:editors="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:local="clr-namespace:Tango.MachineStudio.Common.Resources" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"> <ResourceDictionary.MergedDictionaries> - + <!--WPF Extended Toolkit--> <!--<ResourceDictionary Source="pack://application:,,,/Xceed.Wpf.Toolkit;component/Themes/Generic/Brushes.xaml"/> <ResourceDictionary Source="pack://application:,,,/Xceed.Wpf.Toolkit;component/Themes/Generic/Buttons.xaml"/> @@ -28,7 +29,9 @@ <!--<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml"> </ResourceDictionary> - --><!--Material Design--><!-- + --> + <!--Material Design--> + <!-- <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml"> </ResourceDictionary>--> <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"> @@ -65,7 +68,7 @@ <FontFamily x:Key="digital-7">../Fonts/#digital-7</FontFamily> <FontFamily x:Key="flexo">../Fonts/#flexo</FontFamily> </ResourceDictionary> - + <!--Images--> <ResourceDictionary> <BitmapImage x:Key="MachineBig" UriSource="../Images/machine_new.png"></BitmapImage> @@ -540,16 +543,12 @@ <Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> - <Border Background="Transparent" - BorderBrush="{DynamicResource MaterialDesignShadowBrush}" - BorderThickness="1" - CornerRadius="2"> + <Border Background="Transparent" BorderBrush="{DynamicResource MaterialDesignShadowBrush}" BorderThickness="1" CornerRadius="2"> <Border.Effect> <BlurEffect Radius="6"/> </Border.Effect> </Border> - <Grid Margin="1" - SnapsToDevicePixels="True"> + <Grid Margin="1" SnapsToDevicePixels="True"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> @@ -568,29 +567,18 @@ <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> - <Border Grid.Column="0" - Width="{StaticResource PopupLeftRightMargin}" - Background="{DynamicResource ComboBox.Floating.Background}" - /> - <Grid Grid.Column="1" - Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type materialDesign:ComboBoxPopup}}, Path=VisiblePlacementWidth}" - Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/> - <Border Grid.Column="2" - MinWidth="{StaticResource PopupLeftRightMargin}" - Background="{DynamicResource ComboBox.Floating.Background}" - /> + <Border Grid.Column="0" Width="{StaticResource PopupLeftRightMargin}" Background="{DynamicResource ComboBox.Floating.Background}" /> + <Grid Grid.Column="1" + Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type materialDesign:ComboBoxPopup}}, Path=VisiblePlacementWidth}" + Height="0"/> + <Border Grid.Column="2" MinWidth="{StaticResource PopupLeftRightMargin}" Background="{DynamicResource ComboBox.Floating.Background}"/> </Grid> - <Border Grid.Row="2" - Background="{DynamicResource ComboBox.Floating.Background}" - Height="{StaticResource PopupContentPresenterExtend}"/> + <Border Grid.Row="2" Background="{DynamicResource ComboBox.Floating.Background}" Height="0"/> <ContentPresenter Grid.Row="3"/> - <Border Grid.Row="4" - CornerRadius="0 0 2 2" - Height="{StaticResource PopupTopBottomMargin}" - Background="{DynamicResource ComboBox.Floating.Background}" /> + <Border Grid.Row="4" CornerRadius="0 0 2 2" Height="{StaticResource PopupTopBottomMargin}" Background="{DynamicResource ComboBox.Floating.Background}" /> </Grid> </Grid> </ControlTemplate> @@ -657,7 +645,7 @@ Visibility="{Binding Path=(materialDesign:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}"/> <materialDesign:ComboBoxPopup x:Name="PART_Popup" - + AllowsTransparency="true" Focusable="False" HorizontalOffset="-11.5" @@ -667,9 +655,9 @@ UseLayoutRounding="True" Placement="Custom" PopupAnimation="Fade" - VerticalOffset="0" + VerticalOffset="-10" DefaultVerticalOffset="5" - DownVerticalOffset="-15.5" + DownVerticalOffset="{Binding ElementName=templateRoot, Path=ActualHeight}" UpVerticalOffset="15" ClassicMode="{Binding Path=(materialDesign:ComboBoxAssist.ClassicMode), RelativeSource={RelativeSource TemplatedParent}}" UpContentTemplate="{StaticResource PopupContentUpTemplate}" @@ -690,7 +678,7 @@ <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" /> </Trigger> <Trigger SourceName="PART_Popup" Property="IsOpen" Value="True"> - <Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource ComboBox.Floating.Background}" /> + <Setter Property="Background" TargetName="templateRoot" Value="Transparent" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="templateRoot" Property="Opacity" Value="0.56"/> @@ -782,6 +770,97 @@ </Setter> </Style> + <Style TargetType="{x:Type controls:SearchComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}"> + <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Once"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type controls:SearchComboBox}"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + + <Grid Background="Transparent"> + <DockPanel> + <Grid VerticalAlignment="Center" Margin="15 10 10 10" DockPanel.Dock="Right" Width="10" Height="10"> + <Path Stretch="Uniform" Data="M7,10L12,15L17,10H7Z" Fill="{StaticResource BlackBrush}"> + + </Path> + </Grid> + <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" Content="{TemplateBinding SelectedItem}" ContentTemplate="{TemplateBinding ItemTemplate}"> + + </ContentControl> + </DockPanel> + <ToggleButton x:Name="btnToggle" Focusable="False" FocusVisualStyle="{x:Null}" KeyboardNavigation.DirectionalNavigation="Once" Opacity="0" Style="{x:Null}" IsChecked="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=IsOpened,Mode=TwoWay}"> + + </ToggleButton> + + <Popup StaysOpen="False" MinWidth="{Binding ElementName=btnToggle,Path=ActualWidth}" PlacementTarget="{Binding ElementName=btnToggle}" Placement="Bottom" IsOpen="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=IsOpened,Mode=TwoWay}" MaxHeight="{TemplateBinding MaxDropDownHeight}" AllowsTransparency="True"> + <Border Margin="5" Background="{StaticResource WhiteBrush}" CornerRadius="3" Padding="5" MinWidth="{Binding ElementName=btnToggle,Path=ActualWidth}"> + <Border.Effect> + <DropShadowEffect ShadowDepth="0" /> + </Border.Effect> + <DockPanel> + <TextBox x:Name="txt" KeyboardNavigation.DirectionalNavigation="Once" DockPanel.Dock="Top" Margin="10" Padding="0 5" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=SearchFilter,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox> + <ListBox x:Name="list" FocusVisualStyle="{x:Null}" ItemsSource="{TemplateBinding ListItemsSource}" ItemTemplate="{TemplateBinding ItemTemplate}"> + + </ListBox> + </DockPanel> + </Border> + </Popup> + </Grid> + + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="CheckBoxListBoxItem" TargetType="{x:Type ListBoxItem}"> + <Setter Property="SnapsToDevicePixels" Value="true" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ListBoxItem"> + <CheckBox Margin="5,2" IsChecked="{TemplateBinding IsSelected}" x:Name="CheckBoxItem" + Command="{Binding RelativeSource={RelativeSource AncestorType=controls:AllSelectedCheckboxList}, Path=ClickCheckBoxCommand}" CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}}"> + <ContentPresenter /> + </CheckBox> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="AllSelectedCheckBoxListStyle" TargetType="{x:Type controls:AllSelectedCheckboxList}" BasedOn="{StaticResource MaterialDesignListBox}"> + <!--<Setter Property="OverridesDefaultStyle" Value="true" />--> + <Setter Property="SnapsToDevicePixels" Value="true" /> + <Setter Property="SelectionMode" Value="Multiple"/> + <Setter Property="ItemContainerStyle" Value="{StaticResource CheckBoxListBoxItem}"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type controls:AllSelectedCheckboxList}"> + <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true"> + <DockPanel> + <CheckBox x:Name="SelectAllCheckBox" DockPanel.Dock="Top" VerticalAlignment="Center" IsChecked="{Binding AllSelected, Mode=TwoWay,RelativeSource={RelativeSource AncestorType=controls:AllSelectedCheckboxList}}" Margin="5"> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="SelectAll" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}"></TextBlock> + </CheckBox> + <ScrollViewer DockPanel.Dock="Bottom" Focusable="false" Padding="{TemplateBinding Padding}"> + <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> + </ScrollViewer> + </DockPanel> + </Border> + <ControlTemplate.Triggers> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsGrouping" Value="true"/> + <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/> + </MultiTrigger.Conditions> + <Setter Property="ScrollViewer.CanContentScroll" Value="false"/> + </MultiTrigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + <Style TargetType="Window"> <Setter Property="FontFamily" Value="{StaticResource flexo}"></Setter> </Style> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index d07f75dbd..a14bb4e2a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -298,6 +298,10 @@ <Project>{de2f2b86-025b-4f26-83a4-38bd48224ed5}</Project> <Name>Tango.Editors</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Git\Tango.Git.csproj"> + <Project>{99081c0e-065c-4d68-bf60-f82330cca02d}</Project> + <Name>Tango.Git</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> @@ -427,7 +431,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> <PropertyGroup> |
