Esempio n. 1
0
        private async void SaveDevice(object para)
        {
            DeviceTreeItemViewModel device = para as DeviceTreeItemViewModel;

            if (device != null)
            {
                try
                {
                    WaitInfo = "模型保存中";
                    Status   = ViewModelStatus.Querying;
                    T_Diagnosis_Model t_model = DeviceDiagnoseComponent.ConvertToDB(device.DeviceDiagnoseComponent);
                    if (device.DeviceDiagnoseComponent.id == -1)
                    {
                        device.DeviceDiagnoseComponent.id = await _deviceDiagnoseTemplateService.AddDeviceDiagnoseComponent(device.ServerIP, t_model);
                    }
                    else
                    {
                        await _deviceDiagnoseTemplateService.ModifyDeviceDiagnoseComponent(device.ServerIP, t_model);
                    }
                }
                catch (Exception ex)
                {
                    _eventAggregator.GetEvent <ThrowExceptionEvent>().Publish(Tuple.Create <string, Exception>("设备诊断模型保存", ex));
                }
                finally
                {
                    Status = ViewModelStatus.None;
                }
            }
        }
Esempio n. 2
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            var navigationService = navigationContext.NavigationService;

            devicemodel = navigationContext.Parameters["DeviceDiagnoseComponent"] as DeviceDiagnoseComponent;
            if (devicemodel != null && devicemodel.Component.SelectedShaft != null)
            {
                ShaftComponent = devicemodel.Component.SelectedShaft as ShaftComponent;
            }
        }
Esempio n. 3
0
 public void IntiDeviceDiagnoseComponent(DeviceDiagnoseComponent devicecomponent)
 {
     if (devicecomponent != null)
     {
         this.DeviceDiagnoseComponent = devicecomponent;
     }
     else
     {
         IntiDeviceDiagnoseComponent();
     }
 }
        public async Task <DeviceDiagnoseComponent> GetDeviceDiagnoseComponent(string serverip, Guid guid)
        {
            var t_models = await _databaseComponent.Query <T_Diagnosis_Model>(serverip, null, "(Guid = @0)", new object[] { guid });

            if (t_models != null && t_models.Count > 0)
            {
                var t_model = t_models[0];
                var model   = DeviceDiagnoseComponent.ConvertFromDB(t_model);
                return(model);
            }
            else
            {
                return(null);
            }
        }