diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-08-03 14:19:19 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-08-03 14:19:19 +0300 |
| commit | 269c00bf8857d631c5158cc13976b5aef161c727 (patch) | |
| tree | e0f8c642f2a300a50cff3b308012beb641d7901e /Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage | |
| parent | da1c997c138633c46daa8dc3c099b7164a536eb9 (diff) | |
| download | Tango-269c00bf8857d631c5158cc13976b5aef161c727.tar.gz Tango-269c00bf8857d631c5158cc13976b5aef161c727.zip | |
Added path of current storage directory, Open file dialog on click the path.
Related Work Items: #8719
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage')
3 files changed, 35 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Tango.PPC.Storage.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Tango.PPC.Storage.csproj index e541c472b..3ed0be501 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Tango.PPC.Storage.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Tango.PPC.Storage.csproj @@ -40,6 +40,7 @@ <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> + <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Core" /> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs index db30c01b1..ed7784b2b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; using Tango.Core.Commands; using Tango.Explorer; using Tango.PPC.Common; @@ -79,6 +80,8 @@ namespace Tango.PPC.Storage.ViewModels public RelayCommand OpenCommand { get; set; } + public RelayCommand OpenDirectoryCommand { get; set; } + public MainViewVM() { SelectedItems = new ObservableCollection<ExplorerFileItem>(); @@ -86,6 +89,7 @@ namespace Tango.PPC.Storage.ViewModels SaveCommand = new RelayCommand(OnSaveCommand, (x) => !String.IsNullOrWhiteSpace(FileName) || Request.Intent == StorageNavigationIntent.SaveFiles); Request = new StorageNavigationRequest() { Intent = StorageNavigationIntent.LoadFiles }; OpenCommand = new RelayCommand(OnOpenCommand, () => Request.Intent == StorageNavigationIntent.LoadFiles); + OpenDirectoryCommand = new RelayCommand(OnOpenFileDialogCommand); } public override void OnApplicationStarted() @@ -269,5 +273,29 @@ namespace Tango.PPC.Storage.ViewModels RaisePropertyChanged(nameof(FileName)); } } + + private void OnOpenFileDialogCommand() + { + if(Directory.Exists(CurrentPath) ) + { + Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog + { + InitialDirectory = CurrentPath, + Title = "Browse Job Files", + + CheckFileExists = true, + CheckPathExists = true, + + DefaultExt = "job", + Filter = "job files (*.job)|*.job", + ReadOnlyChecked = true, + ShowReadOnly = true + }; + if (openFileDialog.ShowDialog().Value) + { + StorageProvider.SubmitFileSelection(new List<ExplorerFileItem>() { ExplorerFileItem.LoadFromPath(openFileDialog.FileName) }); + } + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml index c57735a7b..ff1183495 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml @@ -28,7 +28,12 @@ <Border.Effect> <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> </Border.Effect> - <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Storage</TextBlock> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Storage</TextBlock> + <touch:TouchButton Command="{Binding OpenDirectoryCommand}" Style="{StaticResource TangoLinkButton}"> + <TextBlock Margin="20 1 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Text="{Binding CurrentPath}" Foreground="{StaticResource TangoPrimaryAccentBrush}" TextWrapping="Wrap"></TextBlock> + </touch:TouchButton> + </StackPanel> </Border> <Grid Margin="10" Grid.Row="1"> <DockPanel> |
