private void Window_Loaded(object sender, RoutedEventArgs e) { if (objGeneralDba == null) { objGeneralDba = new GeneralDba(); } if (objCMDba == null) { objCMDba = new CMDba(); } lblMachineName.Content = this.MachineCode; SetTriggerStatus(objGeneralDba.GetMachineTriggerStatus(this.MachineCode)); SetEnableStatus(objCMDba.GetCMEnabledStatus(this.MachineCode)); if (this.MachineCode.Contains("LCM")) { SetRotatoinStatusToView(); } else { chkRotation.Visibility = Visibility.Hidden; } }
void timerToUpdateStatus_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { // cmLock.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new InvokeDelegate(SetLockedStatus), objCMDba.GetCMBlockedStatus(MachineCode)); if (objCMDba == null) { objCMDba = new CMDba(); } if (objGeneralDba == null) { objGeneralDba = new GeneralDba(); } this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new InvokeDelegate(SetLockedStatus), objCMDba.GetCMBlockedStatus(MachineCode)); triggerStatus.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new InvokeDelegate(SetTriggerStatus), objGeneralDba.GetMachineTriggerStatus(MachineCode)); disableGrid.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new InvokeDelegate(SetDisableStatus), !objCMDba.GetCMEnabledStatus(MachineCode)); this.QueueId = objCMDba.GetCMQueueId(this.MachineCode); cardIdLabel.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new InvokeDelegateForString(SetCardId), objGeneralDba.GetCardIdFromQueue(this.QueueId)); }