Browse Source

Message Controller

SK.Kang 6 years ago
parent
commit
01132e3b15

+ 1 - 1
Dev/OHV/OHV.Common/OHV.Common.csproj

@@ -68,7 +68,7 @@
     <Compile Include="Model\SelectionList.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Shareds\SharedEnumType.cs" />
-    <Compile Include="Shareds\UIModuleRegionNames.cs" />
+    <Compile Include="Shareds\RegionNames.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />

+ 1 - 1
Dev/OHV/OHV.Common/Shareds/UIModuleRegionNames.cs

@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 
 namespace OHV.Common.Shareds
 {
-    public class UIModuleRegionNames
+    public class RegionNames
     {
         public const string MainView = "MainView";
     }

File diff suppressed because it is too large
+ 69 - 0
Dev/OHV/OHV.Module.Interactivity/ConfirmationPopupView.xaml


+ 20 - 0
Dev/OHV/OHV.Module.Interactivity/ConfirmationPopupView.xaml.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using Prism.Services.Dialogs;
+
+namespace OHV.Module.Interactivity
+{
+    public partial class ConfirmationPopupView : UserControl
+    {
+
+        public ConfirmationPopupView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 69 - 0
Dev/OHV/OHV.Module.Interactivity/ConfirmationPopupViewModel.cs

@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Prism.Commands;
+using Prism.Interactivity.InteractionRequest;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+
+namespace OHV.Module.Interactivity
+{
+    public class ConfirmationPopupViewModel : BindableBase, IDialogAware
+    {
+        private DelegateCommand<string> _closeDialogCommand;
+        public DelegateCommand<string> CloseDialogCommand =>
+            _closeDialogCommand ?? (_closeDialogCommand = new DelegateCommand<string>(CloseDialog));
+
+        private string _message;
+        public string Message
+        {
+            get { return _message; }
+            set { SetProperty(ref _message, value); }
+        }
+
+        private string _title = "Notification";
+        public string Title
+        {
+            get { return _title; }
+            set { SetProperty(ref _title, value); }
+        }
+
+        public event Action<IDialogResult> RequestClose;
+        public ConfirmationPopupViewModel()
+        {
+        }
+
+        protected virtual void CloseDialog(string parameter)
+        {
+            ButtonResult result = ButtonResult.None;
+
+            if (parameter?.ToLower() == "true")
+                result = ButtonResult.OK;
+            else if (parameter?.ToLower() == "false")
+                result = ButtonResult.Cancel;
+
+            RaiseRequestClose(new DialogResult(result));
+        }
+
+        public virtual void RaiseRequestClose(IDialogResult dialogResult)
+        {
+            RequestClose?.Invoke(dialogResult);
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            Message = parameters.GetValue<string>("message");
+        }
+    }
+}

+ 45 - 0
Dev/OHV/OHV.Module.Interactivity/MessageController.cs

@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Prism.Interactivity.InteractionRequest;
+using Prism.Ioc;
+using Prism.Modularity;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+
+namespace OHV.Module.Interactivity
+{
+    public class MessageController : IModule
+    {
+        IDialogService dialogService;
+        public MessageController(IDialogService dialogService)
+        {
+            this.dialogService = dialogService;
+        }
+
+        public void OnInitialized(IContainerProvider containerProvider)
+        {
+        }
+
+        public void RegisterTypes(IContainerRegistry containerRegistry)
+        {
+            containerRegistry.RegisterDialog<NotificatioinView, NotificationViewModel>();
+            containerRegistry.RegisterDialog<ConfirmationPopupView, ConfirmationPopupViewModel>();
+        }
+
+        public void ShowNotificationView(string Message, bool isOK = true)
+        {
+            var dialogPram = new DialogParameters();
+            dialogPram.Add("message", Message);
+            dialogPram.Add("Type", isOK);
+            this.dialogService.ShowDialog("NotificatioinView", dialogPram, null);
+        }
+
+        public void ShowConfirmationPopupView(string Message, Action<IDialogResult> callBack)
+        {
+            this.dialogService.ShowDialog("ConfirmationPopupView", new DialogParameters($"message={Message}"), callBack);
+        }
+    }
+}

File diff suppressed because it is too large
+ 74 - 0
Dev/OHV/OHV.Module.Interactivity/NotificatioinView.xaml


+ 54 - 0
Dev/OHV/OHV.Module.Interactivity/NotificatioinView.xaml.cs

@@ -0,0 +1,54 @@
+using System;
+using System.ComponentModel;
+using System.Windows;
+using System.Windows.Controls;
+using Prism.Interactivity.InteractionRequest;
+
+namespace OHV.Module.Interactivity
+{
+    /// <summary>
+    /// NotificatioinView.xaml에 대한 상호 작용 논리
+    /// </summary>
+    public partial class NotificatioinView : UserControl
+    {
+        public NotificationViewModel ViewModel { get => this.DataContext as NotificationViewModel; }
+
+        //private bool _IsSucessNotification;
+        //public bool IsSucessNotification
+        //{
+        //    get
+        //    {
+        //        return this._IsSucessNotification;
+        //    }
+        //    set
+        //    {
+        //        this._IsSucessNotification = value;
+        //        if (this._IsSucessNotification)
+        //        {
+        //            this.iconError.Visibility = System.Windows.Visibility.Hidden;
+        //            this.iconComplete.Visibility = System.Windows.Visibility.Visible;
+        //        }
+        //        else
+        //        {
+        //            this.iconError.Visibility = System.Windows.Visibility.Visible;
+        //            this.iconComplete.Visibility = System.Windows.Visibility.Hidden;
+        //        }
+        //    }
+        //}
+
+        public NotificatioinView()
+        {
+            InitializeComponent();
+
+            if (!DesignerProperties.GetIsInDesignMode(this))
+            {
+                this.Loaded += NotificatioinView_Loaded;
+            }
+
+        }
+
+        private void NotificatioinView_Loaded(object sender, RoutedEventArgs e)
+        {
+        }
+    }
+}

+ 96 - 0
Dev/OHV/OHV.Module.Interactivity/NotificationViewModel.cs

@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+
+namespace OHV.Module.Interactivity
+{
+    public class NotificationViewModel : BindableBase, IDialogAware
+    {
+        private Visibility errorVisibillity;
+        public Visibility ErrorVisibillity
+        {
+            get { return errorVisibillity; }
+            set { if (SetProperty(ref this.errorVisibillity, value)){ } }
+
+        }
+        private Visibility okVisibillity;
+        public Visibility OKVisibillity
+        {
+            get { return okVisibillity; }
+            set { if (SetProperty(ref this.okVisibillity, value)) { } }
+        }
+
+        private DelegateCommand<string> _closeDialogCommand;
+        public DelegateCommand<string> CloseDialogCommand =>
+            _closeDialogCommand ?? (_closeDialogCommand = new DelegateCommand<string>(CloseDialog));
+
+        private string _message;
+        public string Message
+        {
+            get { return _message; }
+            set { SetProperty(ref _message, value); }
+        }
+
+        private string _title = "Notification";
+        public string Title
+        {
+            get { return _title; }
+            set { SetProperty(ref _title, value); }
+        }
+
+        public event Action<IDialogResult> RequestClose;
+
+        public NotificationViewModel()
+        {
+        }
+
+        protected virtual void CloseDialog(string parameter)
+        {
+            ButtonResult result = ButtonResult.None;
+
+            if (parameter?.ToLower() == "true")
+                result = ButtonResult.OK;
+            else if (parameter?.ToLower() == "false")
+                result = ButtonResult.Cancel;
+
+            RaiseRequestClose(new DialogResult(result));
+        }
+
+        public virtual void RaiseRequestClose(IDialogResult dialogResult)
+        {
+            RequestClose?.Invoke(dialogResult);
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            Message = parameters.GetValue<string>("message");
+
+            var isOK = parameters.GetValue<bool>("Type");
+            if (isOK)
+            {
+                this.ErrorVisibillity = Visibility.Hidden;
+                this.OKVisibillity = Visibility.Visible; 
+            }
+            else
+            {
+                this.ErrorVisibillity = Visibility.Visible;
+                this.OKVisibillity = Visibility.Hidden;
+            }
+        }
+    }
+}

+ 99 - 0
Dev/OHV/OHV.Module.Interactivity/OHV.Module.Interactivity.csproj

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{D6402D97-2206-4D55-8097-8DA9A01568CB}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>OHV.Module.Interactivity</RootNamespace>
+    <AssemblyName>OHV.Module.Interactivity</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="CommonServiceLocator, Version=2.0.4.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
+      <HintPath>..\packages\CommonServiceLocator.2.0.4\lib\net45\CommonServiceLocator.dll</HintPath>
+    </Reference>
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="Prism, Version=7.2.0.1422, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
+      <HintPath>..\packages\Prism.Core.7.2.0.1422\lib\net45\Prism.dll</HintPath>
+    </Reference>
+    <Reference Include="Prism.Wpf, Version=7.2.0.1422, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
+      <HintPath>..\packages\Prism.Wpf.7.2.0.1422\lib\net45\Prism.Wpf.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Prism.Wpf.7.2.0.1422\lib\net45\System.Windows.Interactivity.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xaml" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MessageController.cs" />
+    <Compile Include="ConfirmationPopupView.xaml.cs">
+      <DependentUpon>ConfirmationPopupView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="ConfirmationPopupViewModel.cs">
+      <DependentUpon>ConfirmationPopupView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="NotificatioinView.xaml.cs">
+      <DependentUpon>NotificatioinView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="NotificationViewModel.cs">
+      <DependentUpon>NotificatioinView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\GSG\GSG\GSG.NET.WPF\GSG.NET.WPF.csproj">
+      <Project>{6b91fca2-0a26-41d5-8959-a6f27645dacd}</Project>
+      <Name>GSG.NET.WPF</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Page Include="ConfirmationPopupView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="NotificatioinView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 36 - 0
Dev/OHV/OHV.Module.Interactivity/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 
+// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
+// 이러한 특성 값을 변경하세요.
+[assembly: AssemblyTitle("OHV.Module.Interactivity")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OHV.Module.Interactivity")]
+[assembly: AssemblyCopyright("Copyright ©  2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 
+// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
+// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
+[assembly: ComVisible(false)]
+
+// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
+[assembly: Guid("d6402d97-2206-4d55-8097-8da9a01568cb")]
+
+// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
+//
+//      주 버전
+//      부 버전 
+//      빌드 번호
+//      수정 버전
+//
+// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
+// 기본값으로 할 수 있습니다.
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 7 - 0
Dev/OHV/OHV.Module.Interactivity/packages.config

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="CommonServiceLocator" version="2.0.4" targetFramework="net45" />
+  <package id="Prism.Core" version="7.2.0.1422" targetFramework="net45" />
+  <package id="Prism.Wpf" version="7.2.0.1422" targetFramework="net45" />
+  <package id="System.ValueTuple" version="4.5.0" targetFramework="net45" />
+</packages>

+ 2 - 2
Dev/OHV/OHV.Module.MainViews/MainViewModules.cs

@@ -20,8 +20,8 @@ namespace OHV.Module.MainViews
             ViewModelLocationProvider.Register<ModuleAutoView, ModuleAutoViewModel>();
 
             var regionManager = containerProvider.Resolve<IRegionManager>();
-            regionManager.RegisterViewWithRegion(UIModuleRegionNames.MainView, typeof(ModuleAutoView));
-            regionManager.RegisterViewWithRegion(UIModuleRegionNames.MainView, typeof(DeviceView));
+            regionManager.RegisterViewWithRegion(RegionNames.MainView, typeof(ModuleAutoView));
+            regionManager.RegisterViewWithRegion(RegionNames.MainView, typeof(DeviceView));
         }
 
         public void RegisterTypes(IContainerRegistry containerRegistry)

+ 1 - 1
Dev/OHV/OHV.Module.MainViews/Views/DeviceView.xaml

@@ -15,7 +15,7 @@
             <ColumnDefinition Width="1*"/>
         </Grid.ColumnDefinitions>
 
-        <ContentControl prism:RegionManager.RegionName="IOView"/>
+        <ContentControl Grid.Column="1" prism:RegionManager.RegionName="IOView"/>
 
     </Grid>
 </UserControl>

+ 4 - 4
Dev/OHV/OHV.Module.Monitoring/Interactivity/InOutIOView.xaml

@@ -33,13 +33,13 @@
                 </TextBlock>
             </StackPanel>
 
-            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Width="320">
-                <Button Width="89" Margin="20, 0" FontWeight="Bold" Command="{Binding ChangePageCommand}" CommandParameter="Pre">
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Width="350">
+                <Button Width="110" Margin="20,9" FontWeight="Bold" Command="{Binding ChangePageCommand}" CommandParameter="Pre">
                     <TextBlock><Run Text="Pre Page"/></TextBlock>
                 </Button>
-                <Label Width="60" Content="{Binding CurrentPage, FallbackValue=1 }" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold">
+                <Label Width="50" Content="{Binding CurrentPage, FallbackValue=1 }" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold">
                 </Label>
-                <Button Width="89" Margin="20, 0" HorizontalAlignment="Right" FontWeight="Bold" Command="{Binding ChangePageCommand}" CommandParameter="Next" >
+                <Button Width="110" Margin="20,9" HorizontalAlignment="Right" FontWeight="Bold" Command="{Binding ChangePageCommand}" CommandParameter="Next" >
                     <TextBlock><Run Text="Next Page"/></TextBlock>
                 </Button>
             </StackPanel>

+ 1 - 0
Dev/OHV/OHV.Vehicle/App.xaml.cs

@@ -86,6 +86,7 @@ namespace OHV.Vehicle
             moduleCatalog.AddModule(typeof(VCSystem));
             moduleCatalog.AddModule(typeof(OHV.Module.Monitoring.MonitoringModules));
             moduleCatalog.AddModule(typeof(OHV.Module.MainViews.MainViewModules));
+            moduleCatalog.AddModule(typeof(OHV.Module.Interactivity.MessageController));
         }
 
     }

+ 8 - 7
Dev/OHV/OHV.Vehicle/MainWindow.xaml

@@ -10,13 +10,14 @@
         xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
         mc:Ignorable="d"
         Title="{Binding Title}" Height="800" Width="1280"
+        WindowStyle="None"
         xmlns:OHVCommonShareds="clr-namespace:OHV.Common.Shareds;assembly=OHV.Common"
-        >
+        xmlns:Behavior="clr-namespace:GSG.NET.WPF.Behavior;assembly=GSG.NET.WPF">
 
     <Window.Resources>
         <Storyboard x:Key="MenuOpen">
             <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="GridMenu" >
-                <EasingDoubleKeyFrame KeyTime="0" Value="70"/>
+                <EasingDoubleKeyFrame KeyTime="0" Value="60"/>
                 <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="200"/>
             </DoubleAnimationUsingKeyFrames>
         </Storyboard>
@@ -24,7 +25,7 @@
         <Storyboard x:Key="MenuClose">
             <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="GridMenu" >
                 <EasingDoubleKeyFrame KeyTime="0" Value="200"/>
-                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="70"/>
+                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="60"/>
             </DoubleAnimationUsingKeyFrames>
         </Storyboard>
     </Window.Resources>
@@ -39,12 +40,12 @@
         </EventTrigger>
     </Window.Triggers>
 
-    <Grid Background="{x:Null}">
+    <Grid Background="{x:Null}" >
         <!--<Grid x:Name="GridMain" HorizontalAlignment="Right" VerticalAlignment="Bottom" Height="540" Width="1020"/>-->
         <DockPanel LastChildFill="True">
-            <ContentControl prism:RegionManager.RegionName="MainView" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="1212" Height="710"/>
+            <ContentControl prism:RegionManager.RegionName="{x:Static OHVCommonShareds:RegionNames.MainView}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="1212" Height="710"/>
         </DockPanel>
-        <Grid Height="60" VerticalAlignment="Top" Background="#FF1368BD">
+        <Grid Height="60" VerticalAlignment="Top" Background="#FF1368BD" x:Name="gridHead">
             <TextBlock Text="Over Head Vehicle" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Foreground="White"/>
             <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right">
                 <TextBlock Text="Current Mode   [IDLE ? RUN] " VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="18" Foreground="White"/>
@@ -53,7 +54,7 @@
                         <Button Content="Settings"/>
                         <Button Content="Help"/>
                         <Separator/>
-                        <Button x:Name="ButtonPopUpLogout" Content="LogOut" />
+                        <Button x:Name="ButtonPopUpLogout" Content="System Off" Command="{Binding SystemOffCommand}" />
                     </StackPanel>
                 </materialDesign:PopupBox>
             </StackPanel>

+ 18 - 2
Dev/OHV/OHV.Vehicle/MainWindow.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -27,8 +28,23 @@ namespace OHV.Vehicle
         {
             InitializeComponent();
 
-            this.Loaded += MainWindow_Loaded;
-            this.Closing += MainWindow_Closing;
+            if (!DesignerProperties.GetIsInDesignMode(this))
+            {
+                this.gridHead.MouseLeftButtonDown += GridMain_MouseLeftButtonDown;
+                this.Loaded += MainWindow_Loaded;
+                this.Closing += MainWindow_Closing;
+            }
+        }
+
+        private void GridMain_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            e.Handled = true;
+            if (e.ClickCount > 1)
+            {
+
+            }
+            else
+                this.DragMove();
         }
 
         private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)

+ 26 - 10
Dev/OHV/OHV.Vehicle/MainWindowViewModel.cs

@@ -11,10 +11,13 @@ using Prism.Regions;
 using OHV.Common.Shareds;
 using System.Windows.Documents;
 using System.Windows.Controls;
+using System.Windows;
+using OHV.Module.Interactivity;
+using Prism.Interactivity.InteractionRequest;
+using Prism.Services.Dialogs;
 
 namespace OHV.Vehicle
 {
-    [ModuleDependency("VCSystem")]
     public class MainWindowViewModel :BindableBase
     {
         private string _title = "Prism Unity Application";
@@ -26,24 +29,37 @@ namespace OHV.Vehicle
 
         IEventAggregator eventAggregator = null;
         VCSystem VCSystem = null;
+        MessageController messageController;
 
         public ICommand TestCommand { get; set; }
         public ICommand NavigateCommand { get; set; }
+        public ICommand SystemOffCommand { get; set; }
 
         IRegionManager regionManager;
         //public DelegateCommand<string> NavigateCommand { get; private set; }
 
-        public MainWindowViewModel(IEventAggregator ea, VCSystem cSystem, IRegionManager _regionManager)
+        public MainWindowViewModel(IEventAggregator ea, VCSystem cSystem, IRegionManager _regionManager, MessageController messageController)
         {
+            this.regionManager = _regionManager;
+
             this.eventAggregator = ea;
             this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Subscribe(UICallbackCommunication, ThreadOption.UIThread);
 
             this.VCSystem = cSystem;
+            this.messageController = messageController;
 
             this.TestCommand = new DelegateCommand(ExecuteTextCommand);
+            this.NavigateCommand = new DelegateCommand<object>(Navigate);
+            this.SystemOffCommand = new DelegateCommand(ExecuteSystemOffCommand);
+        }
 
-            this.regionManager = _regionManager;
-            NavigateCommand = new DelegateCommand<object>(Navigate);
+        private void ExecuteSystemOffCommand()
+        {
+            this.messageController.ShowConfirmationPopupView("System ShutDown ?", r =>
+            {
+                if (r.Result == ButtonResult.OK)
+                    App.Current.Shutdown();
+            });
         }
 
         private void Navigate(object obj)
@@ -70,14 +86,14 @@ namespace OHV.Vehicle
         public void InitViewModel()
         {
             //VCSystem.Instance.Init();
-            //var containerRegistry = ServiceLocator.Current.GetInstance<VCSystem>();
-            //if (containerRegistry.Equals(this.VCSystem))
-            //{
-            //    Console.WriteLine("==");
-            //}
+            var containerRegistry = ServiceLocator.Current.GetInstance<VCSystem>();
+            if (containerRegistry.Equals(this.VCSystem))
+            {
+                Console.WriteLine("==");
+            }
             //var vsys = containerRegistry.GetContainer().Resolve<IContainerProvider>();
 
-            regionManager.RequestNavigate(UIModuleRegionNames.MainView, "ModuleAutoView");
+            regionManager.RequestNavigate(RegionNames.MainView, "ModuleAutoView");
         }
 
         public void Dispose()

+ 4 - 0
Dev/OHV/OHV.Vehicle/OHV.Vehicle.csproj

@@ -180,6 +180,10 @@
       <Project>{0d1f7fbc-bfb0-4ee4-852d-e2a8d62c5708}</Project>
       <Name>OHV.Common</Name>
     </ProjectReference>
+    <ProjectReference Include="..\OHV.Module.Interactivity\OHV.Module.Interactivity.csproj">
+      <Project>{d6402d97-2206-4d55-8097-8da9a01568cb}</Project>
+      <Name>OHV.Module.Interactivity</Name>
+    </ProjectReference>
     <ProjectReference Include="..\OHV.Module.MainViews\OHV.Module.MainViews.csproj">
       <Project>{eafdb5ff-20f9-4172-9a11-ec8cf3ab6edc}</Project>
       <Name>OHV.Module.MainViews</Name>

+ 7 - 0
Dev/OHV/OHV.sln

@@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OHV.Module.Monitoring", "OH
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OHV.Module.MainViews", "OHV.Module.MainViews\OHV.Module.MainViews.csproj", "{EAFDB5FF-20F9-4172-9A11-EC8CF3AB6EDC}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OHV.Module.Interactivity", "OHV.Module.Interactivity\OHV.Module.Interactivity.csproj", "{D6402D97-2206-4D55-8097-8DA9A01568CB}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -81,6 +83,10 @@ Global
 		{EAFDB5FF-20F9-4172-9A11-EC8CF3AB6EDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{EAFDB5FF-20F9-4172-9A11-EC8CF3AB6EDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{EAFDB5FF-20F9-4172-9A11-EC8CF3AB6EDC}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D6402D97-2206-4D55-8097-8DA9A01568CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D6402D97-2206-4D55-8097-8DA9A01568CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D6402D97-2206-4D55-8097-8DA9A01568CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D6402D97-2206-4D55-8097-8DA9A01568CB}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -97,6 +103,7 @@ Global
 		{73BAB40E-FC7D-4AB5-85CA-B4CF221DFBD1} = {E991DE17-D541-45A9-85B0-1AA1B0D50D89}
 		{CF748E61-69C2-4DEC-A9EC-755B6999077E} = {6C7A1445-7F2F-46C4-9AAD-AEB739F9BD2D}
 		{EAFDB5FF-20F9-4172-9A11-EC8CF3AB6EDC} = {6C7A1445-7F2F-46C4-9AAD-AEB739F9BD2D}
+		{D6402D97-2206-4D55-8097-8DA9A01568CB} = {6C7A1445-7F2F-46C4-9AAD-AEB739F9BD2D}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {2222F9E2-CBEF-4156-9636-5DF54ECDDA89}