|
|
@@ -1,5 +1,6 @@
|
|
|
using CommonServiceLocator;
|
|
|
using OHV.Common.Events;
|
|
|
+using OHV.Common.Model;
|
|
|
using OHV.Common.Shareds;
|
|
|
using OHV.Module.Interactivity;
|
|
|
using OHV.SqliteDAL;
|
|
|
@@ -29,14 +30,14 @@ namespace OHV.Vehicle.Concept
|
|
|
public string Title
|
|
|
{
|
|
|
get { return _title; }
|
|
|
- set { SetProperty( ref _title , value ); }
|
|
|
+ set { SetProperty(ref _title, value); }
|
|
|
}
|
|
|
|
|
|
private double _cpu;
|
|
|
public double CPU
|
|
|
{
|
|
|
get { return this._cpu; }
|
|
|
- set { this.SetProperty( ref this._cpu , value ); }
|
|
|
+ set { this.SetProperty(ref this._cpu, value); }
|
|
|
}
|
|
|
private double _totalCPU;
|
|
|
public double TotalCPU
|
|
|
@@ -45,7 +46,7 @@ namespace OHV.Vehicle.Concept
|
|
|
set
|
|
|
{
|
|
|
//this._totalCPU = dti.cpuResult.ToString();
|
|
|
- this.SetProperty( ref this._totalCPU , value );
|
|
|
+ this.SetProperty(ref this._totalCPU, value);
|
|
|
}
|
|
|
}
|
|
|
public int UsageCPU { get; set; }
|
|
|
@@ -54,14 +55,14 @@ namespace OHV.Vehicle.Concept
|
|
|
public double RAM
|
|
|
{
|
|
|
get { return this._ram; }
|
|
|
- set { this.SetProperty( ref this._ram , value ); }
|
|
|
+ set { this.SetProperty(ref this._ram, value); }
|
|
|
}
|
|
|
|
|
|
private double _cDrive;
|
|
|
public double CDrive
|
|
|
{
|
|
|
get { return this._cDrive; }
|
|
|
- set { this.SetProperty( ref this._cDrive , value ); }
|
|
|
+ set { this.SetProperty(ref this._cDrive, value); }
|
|
|
}
|
|
|
|
|
|
DateTime _dateTime;
|
|
|
@@ -70,7 +71,7 @@ namespace OHV.Vehicle.Concept
|
|
|
get { return _dateTime; }
|
|
|
set
|
|
|
{
|
|
|
- this.SetProperty( ref _dateTime , value );
|
|
|
+ this.SetProperty(ref _dateTime, value);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -78,7 +79,7 @@ namespace OHV.Vehicle.Concept
|
|
|
public string VehicleID
|
|
|
{
|
|
|
get { return this._vehicleID; }
|
|
|
- set { this.SetProperty( ref this._vehicleID , value ); }
|
|
|
+ set { this.SetProperty(ref this._vehicleID, value); }
|
|
|
}
|
|
|
|
|
|
private string _vehicleIP = "127.0.0.1";
|
|
|
@@ -103,7 +104,7 @@ namespace OHV.Vehicle.Concept
|
|
|
get { return _ocsBrush; }
|
|
|
set
|
|
|
{
|
|
|
- SetProperty( ref _ocsBrush , value );
|
|
|
+ SetProperty(ref _ocsBrush, value);
|
|
|
}
|
|
|
}
|
|
|
public Brush BatteryBrush
|
|
|
@@ -111,7 +112,7 @@ namespace OHV.Vehicle.Concept
|
|
|
get { return _batteryBrush; }
|
|
|
set
|
|
|
{
|
|
|
- SetProperty( ref _batteryBrush , value );
|
|
|
+ SetProperty(ref _batteryBrush, value);
|
|
|
}
|
|
|
}
|
|
|
public Brush LaserBrush
|
|
|
@@ -119,7 +120,7 @@ namespace OHV.Vehicle.Concept
|
|
|
get { return this._laserBrush; }
|
|
|
set
|
|
|
{
|
|
|
- SetProperty( ref _laserBrush , value );
|
|
|
+ SetProperty(ref _laserBrush, value);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -127,25 +128,32 @@ namespace OHV.Vehicle.Concept
|
|
|
public string SwVersion
|
|
|
{
|
|
|
get { return this._swVersion; }
|
|
|
- set { this.SetProperty( ref this._swVersion , value ); }
|
|
|
+ set { this.SetProperty(ref this._swVersion, value); }
|
|
|
}
|
|
|
|
|
|
private DateTime _lastBuildedTime;
|
|
|
public DateTime LastBuildedTime
|
|
|
{
|
|
|
get { return this._lastBuildedTime; }
|
|
|
- set { this.SetProperty( ref this._lastBuildedTime , value ); }
|
|
|
+ set { this.SetProperty(ref this._lastBuildedTime, value); }
|
|
|
}
|
|
|
|
|
|
IEventAggregator eventAggregator = null;
|
|
|
VCSystem VCSystem = null;
|
|
|
MessageController messageController;
|
|
|
|
|
|
+ VCSMessagePubSubEvent vcsMessagePublisher;
|
|
|
+
|
|
|
public ICommand TestCommand { get; set; }
|
|
|
public ICommand NavigateCommand { get; set; }
|
|
|
public ICommand SystemOffCommand { get; set; }
|
|
|
+<<<<<<< HEAD
|
|
|
public ICommand BuzzerStopCommand { get; set; }
|
|
|
public ICommand EmergencyStopCommand { get; set; }
|
|
|
+=======
|
|
|
+ public ICommand StartCommand { get; set; }
|
|
|
+ public ICommand StopCommand { get; set; }
|
|
|
+>>>>>>> 52c448e88e2005d6b9bc85ad2c7b734e5cb29907
|
|
|
|
|
|
IRegionManager regionManager;
|
|
|
public Common.Events.HostConnectedEventArgs.eConnectedState State { get; set; }
|
|
|
@@ -159,6 +167,7 @@ namespace OHV.Vehicle.Concept
|
|
|
//LanguageHalper.LanguagesSelcter.ChangLanguage(LanguageHalper.eLanguageType.Chinese);
|
|
|
}
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
SqliteManager sql;
|
|
|
|
|
|
public D_MainWindowViewModel( IEventAggregator _ea , VCSystem cSystem , IRegionManager _regionManager , MessageController _msgController, SqliteManager _sql )
|
|
|
@@ -168,6 +177,16 @@ namespace OHV.Vehicle.Concept
|
|
|
this.eventAggregator = _ea;
|
|
|
this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Subscribe( UICallbackCommunication , ThreadOption.UIThread );
|
|
|
this.eventAggregator.GetEvent<HostConnectedPubSubEvent>().Subscribe( OcsConnectCallBack , ThreadOption.UIThread , false );
|
|
|
+=======
|
|
|
+ public D_MainWindowViewModel(IEventAggregator ea, VCSystem cSystem, IRegionManager _regionManager, MessageController messageController)
|
|
|
+ {
|
|
|
+ this.regionManager = _regionManager;
|
|
|
+
|
|
|
+ this.eventAggregator = ea;
|
|
|
+ this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Subscribe(UICallbackCommunication, ThreadOption.UIThread);
|
|
|
+ this.eventAggregator.GetEvent<HostConnectedPubSubEvent>().Subscribe(OcsConnectCallBack, ThreadOption.UIThread, false);
|
|
|
+ vcsMessagePublisher = this.eventAggregator.GetEvent<VCSMessagePubSubEvent>();
|
|
|
+>>>>>>> 52c448e88e2005d6b9bc85ad2c7b734e5cb29907
|
|
|
|
|
|
this.VCSystem = cSystem;
|
|
|
this.messageController = _msgController;
|
|
|
@@ -178,27 +197,29 @@ namespace OHV.Vehicle.Concept
|
|
|
this.OcsIP = sql.ConfigDal.GetK( ConstString.Addr ).Value;
|
|
|
|
|
|
//this.TestCommand = new DelegateCommand( ExecuteTextCommand );
|
|
|
- this.NavigateCommand = new DelegateCommand<object>( this.Navigate );
|
|
|
- this.SystemOffCommand = new DelegateCommand( ExecuteSystemOffCommand );
|
|
|
+ this.NavigateCommand = new DelegateCommand<object>(this.Navigate);
|
|
|
+ this.SystemOffCommand = new DelegateCommand(ExecuteSystemOffCommand);
|
|
|
this.ChangeLanguage = new DelegateCommand(Execte_ChangeLanguage);
|
|
|
+ this.StartCommand = new DelegateCommand(ExecuteStartCommand);
|
|
|
+ this.StopCommand = new DelegateCommand(ExecuteStopCommand);
|
|
|
|
|
|
DispatcherTimer dateTimer = new DispatcherTimer();
|
|
|
- dateTimer.Tick += ( object sender , EventArgs e ) =>
|
|
|
+ dateTimer.Tick += (object sender, EventArgs e) =>
|
|
|
{
|
|
|
this.DateTime = DateTime.Now;
|
|
|
-
|
|
|
+
|
|
|
};
|
|
|
- dateTimer.Interval = TimeSpan.FromMilliseconds( 500 );
|
|
|
+ dateTimer.Interval = TimeSpan.FromMilliseconds(500);
|
|
|
dateTimer.Start();
|
|
|
|
|
|
DispatcherTimer deskTopTimer = new DispatcherTimer();
|
|
|
- deskTopTimer.Tick += ( object sender , EventArgs e ) =>
|
|
|
+ deskTopTimer.Tick += (object sender, EventArgs e) =>
|
|
|
{
|
|
|
this.CPU = dti.GetCpuUsage();
|
|
|
- this.UsageCPU = ( int )dti.GetCpuUsage();
|
|
|
+ this.UsageCPU = (int)dti.GetCpuUsage();
|
|
|
this.RAM = dti.GetRamUsage();
|
|
|
};
|
|
|
- deskTopTimer.Interval = TimeSpan.FromMilliseconds( 1000 );
|
|
|
+ deskTopTimer.Interval = TimeSpan.FromMilliseconds(1000);
|
|
|
deskTopTimer.Start();
|
|
|
|
|
|
this._totalCPU = dti.cpuResult;
|
|
|
@@ -208,11 +229,41 @@ namespace OHV.Vehicle.Concept
|
|
|
this.LastBuildedTime = new Helpler.AssemblyInfo().Get_BuildDateTime();
|
|
|
}
|
|
|
|
|
|
- private void OcsConnectCallBack( HostConnectedEventArgs obj )
|
|
|
+ private void ExecuteStopCommand()
|
|
|
+ {
|
|
|
+ this.messageController.ShowConfirmationPopupView("Request Vehicle Auto Mode ?", r =>
|
|
|
+ {
|
|
|
+ if (r.Result == ButtonResult.OK)
|
|
|
+ {
|
|
|
+ var msg = new VCSMessageEventArgs
|
|
|
+ {
|
|
|
+ Kind = VCSMessageEventArgs.eVCSMessageKind.ReqManualModeChange,
|
|
|
+ };
|
|
|
+ vcsMessagePublisher.Publish(msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ExecuteStartCommand()
|
|
|
+ {
|
|
|
+ this.messageController.ShowConfirmationPopupView("Request Vehicle Auto Mode ?", r =>
|
|
|
+ {
|
|
|
+ if (r.Result == ButtonResult.OK)
|
|
|
+ {
|
|
|
+ var msg = new VCSMessageEventArgs
|
|
|
+ {
|
|
|
+ Kind = VCSMessageEventArgs.eVCSMessageKind.ReqAutoModeChange,
|
|
|
+ };
|
|
|
+ vcsMessagePublisher.Publish(msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OcsConnectCallBack(HostConnectedEventArgs obj)
|
|
|
{
|
|
|
this.State = obj.State;
|
|
|
|
|
|
- switch ( this.State )
|
|
|
+ switch (this.State)
|
|
|
{
|
|
|
case HostConnectedEventArgs.eConnectedState.Disconnected:
|
|
|
this.OcsBrush = Brushes.Yellow;
|
|
|
@@ -223,38 +274,65 @@ namespace OHV.Vehicle.Concept
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSystemOffCommand( )
|
|
|
+ private void ExecuteSystemOffCommand()
|
|
|
{
|
|
|
- this.messageController.ShowConfirmationPopupView( "System ShutDown ?" , r =>
|
|
|
- {
|
|
|
- if ( r.Result == ButtonResult.OK )
|
|
|
- App.Current.Shutdown();
|
|
|
- } );
|
|
|
+ this.messageController.ShowConfirmationPopupView("System ShutDown ?", r =>
|
|
|
+ {
|
|
|
+ if (r.Result == ButtonResult.OK)
|
|
|
+ App.Current.Shutdown();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- private void Navigate( object obj )
|
|
|
+ private void Navigate(object obj)
|
|
|
{
|
|
|
var selectItem = obj.ToString();
|
|
|
- if ( !string.IsNullOrEmpty(selectItem ))
|
|
|
- regionManager.RequestNavigate( "MainView" , selectItem );
|
|
|
+ if (!string.IsNullOrEmpty(selectItem))
|
|
|
+ regionManager.RequestNavigate("MainView", selectItem);
|
|
|
}
|
|
|
|
|
|
- private void UICallbackCommunication( GUIMessageEventArgs obj )
|
|
|
+ private void UICallbackCommunication(GUIMessageEventArgs obj)
|
|
|
{
|
|
|
+ switch (obj.Kind)
|
|
|
+ {
|
|
|
+ case GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange:
|
|
|
+ this.UICallBackModelPropertyChange(obj);
|
|
|
+ break;
|
|
|
+ case GUIMessageEventArgs.eGUIMessageKind.RspIOObject:
|
|
|
+ break;
|
|
|
+ case GUIMessageEventArgs.eGUIMessageKind.RspIOMapList:
|
|
|
+ break;
|
|
|
+ case GUIMessageEventArgs.eGUIMessageKind.RspCommandList:
|
|
|
+ break;
|
|
|
+ case GUIMessageEventArgs.eGUIMessageKind.RspAutoModeChange:
|
|
|
+ break;
|
|
|
+ case GUIMessageEventArgs.eGUIMessageKind.RspManualModeChange:
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void UICallBackModelPropertyChange(GUIMessageEventArgs args)
|
|
|
+ {
|
|
|
+ if (args.MessageKey.Equals(MessageKey.Alarm))
|
|
|
+ {
|
|
|
+ var hisAlarm = args.Args as HisAlarm;
|
|
|
+ this.messageController.ShowNotificationView(args.MessageText);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private void ExecuteTextCommand( )
|
|
|
+ private void ExecuteTextCommand()
|
|
|
{
|
|
|
var m = new VCSMessageEventArgs();
|
|
|
m.MessageKey = 1234;
|
|
|
m.MessageText = "Test Message";
|
|
|
- m.Command = new Common.Model.Command() { CommandID = "TestCommand123" , Type = Common.Shareds.eCommandType.Move };
|
|
|
+ m.Command = new Common.Model.Command() { CommandID = "TestCommand123", Type = Common.Shareds.eCommandType.Move };
|
|
|
|
|
|
- this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish( m );
|
|
|
+ this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish(m);
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void InitViewModel( )
|
|
|
+ public void InitViewModel()
|
|
|
{
|
|
|
//VCSystem.Instance.Init();
|
|
|
//var containerRegistry = ServiceLocator.Current.GetInstance<VCSystem>();
|
|
|
@@ -264,10 +342,10 @@ namespace OHV.Vehicle.Concept
|
|
|
//}
|
|
|
//var vsys = containerRegistry.GetContainer().Resolve<IContainerProvider>();
|
|
|
|
|
|
- regionManager.RequestNavigate( RegionNames.MainView , "AutoView" );
|
|
|
+ regionManager.RequestNavigate(RegionNames.MainView, "AutoView");
|
|
|
}
|
|
|
|
|
|
- public void Dispose( )
|
|
|
+ public void Dispose()
|
|
|
{
|
|
|
//VCSystem.Instance.Dispose();
|
|
|
}
|