123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using Aitex.Core.Observer;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using Aitex.Triton160.Common;
- using Aitex.Triton160.UI.ViewModel;
- namespace Aitex.Triton160.UI.Views
- {
- /// <summary>
- /// FAView.xaml 的交互逻辑
- /// </summary>
- public partial class FAView : UserControl
- {
- public FAView()
- {
- InitializeComponent();
- this.DataContext = new FAViewModel();
- this.IsVisibleChanged += OnIsVisibleChanged;
- var obj = Wcf.WcfClient.Instance.Query.GetConfig(SCName.System_IsMesMode);
- IsAutoToggleButton.IsChecked= obj.ToString()=="True"?true:false;
- }
- private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
- {
- (this.DataContext as FAViewModel).EnableTimer(IsVisible);
- }
- private void ToggleButton_Checked(object sender, RoutedEventArgs e)
- {
- GlobalObserver.Instance.IsAutoRaiseChanged(true);
- //bool isAuto = IsAutoToggleButton.IsChecked;
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.SetConfig.ToString(), SCName.System_IsMesMode, true);
- }
- private void ToggleButton_Unchecked(object sender, RoutedEventArgs e)
- {
- GlobalObserver.Instance.IsAutoRaiseChanged(false);
- //bool isAuto = IsAutoToggleButton.IsChecked == true ? true : false;
- Triton160UiSystem.Instance.WCF.Invoker.DoOperation(TritonOperation.SetConfig.ToString(), SCName.System_IsMesMode, false);
- }
- }
- public enum FAControlState
- {
- Unknown,
- EquipmentOffline,
- AttemptOnline,
- HostOffline,
- OnlineLocal,
- OnlineRemote,
- }
- public enum FACommunicationState
- {
- Disabled,
- Enabled,
- EnabledNotCommunicating,
- EnabledCommunicating,
- WaitCRA,
- WaitDelay,
- WaitCRFromHost,
- }
- class FAViewModel : UIViewModelBase
- {
-
- [Subscription("System.ControlStatus")]
- public string HostControlStatus
- {
- get;
- set;
- }
- [Subscription("System.CommunicationStatus")]
- public string HostCommunicationStatus
- {
- get;
- set;
- }
- public FACommunicationState FACommunicationState
- {
- get
- {
- return string.IsNullOrEmpty(HostCommunicationStatus) ? FACommunicationState.Disabled
- : (FACommunicationState)Enum.Parse(typeof(FACommunicationState), HostCommunicationStatus);
- }
- }
- public FAControlState FAControlState
- {
- get
- {
- return string.IsNullOrEmpty(HostControlStatus) ? FAControlState.Unknown
- : (FAControlState)Enum.Parse(typeof(FAControlState), HostControlStatus);
- }
- }
- //Disabled,
- //Enabled,
- //EnabledNotCommunicating,
- //EnabledCommunicating,
- //WaitCRA,
- //WaitDelay,
- //WaitCRFromHost,
- public bool IsEnableEnableButton
- {
- get { return FACommunicationState == FACommunicationState.Disabled; }
- }
- public bool IsEnableDisableButton
- {
- get { return FACommunicationState != FACommunicationState.Disabled; }
- }
- //Unknown,
- //EquipmentOffline,
- //AttemptOnline,
- //HostOffline,
- //OnlineLocal,
- //OnlineRemote,
- public bool IsEnableOnlineButton
- {
- get { return FAControlState == FAControlState.Unknown || FAControlState == FAControlState.EquipmentOffline; }
- }
- public bool IsEnableOfflineButton
- {
- get { return FAControlState == FAControlState.Unknown || FAControlState != FAControlState.EquipmentOffline; }
- }
- public bool IsEnableLocalButton
- {
- get { return FAControlState == FAControlState.OnlineRemote; }
- }
- public bool IsEnableRemoteButton
- {
- get { return FAControlState == FAControlState.OnlineLocal; }
- }
-
- public FAViewModel():base(nameof(FAViewModel))
- {
- }
- protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
- {
- }
- }
- }
|