async void SafeStart() { // Change Text var text = BtnStartXYWE.Text; BtnStartXYWE.Text = "正在启动XYWE……"; BtnStartXYWE.Enabled = false; BtnStartXYWE.Refresh(); // http://stackoverflow.com/questions/570537/update-label-while-processing-in-windows-forms // Refresh Tip XYTip.Refresh(); // Refresh Editor Source XYSource.RefreshEditor(); // Compile await Task.Run(() => { XYFile.Compile(XYPath.Dir.Source); }); // Refresh Enabled Package UI Config XYConfig.RefreshConfig(); // Execute Plugin if (XYPlugin.RSJB_WE_TextEditor_16_0.GetEnableState()) { XYPlugin.RSJB_WE_TextEditor_16_0.SafeStart(); } // Recover Text BtnStartXYWE.Enabled = true; BtnStartXYWE.Text = text; // Start XYWE XYProcess.Application.StartXYWE(); }
private void LoadXY(int sPH1, int sPH2, int cYL1, int cYL2) { //每次都刷新 _CSPH1 = -1; _CSPH2 = -1; ///////////////////////////////////// if (_CSPH1 != sPH1 || _CSPH2 != sPH2) { _CSPH1 = sPH1; _CSPH2 = sPH2; XYSource.Clear(); #region SPH排序 if (sPH2 <= 0) { for (int i = sPH2; i >= sPH1; i -= 25) { XYSource.Add(new ComXYInputDataSource() { C0 = i }); } } else if (sPH1 >= 0) { for (int i = sPH1; i <= sPH2; i += 25) { XYSource.Add(new ComXYInputDataSource() { C0 = i }); } } else { for (int i = 0; i >= sPH1; i -= 25) { XYSource.Add(new ComXYInputDataSource() { C0 = i }); } for (int i = 25; i <= sPH2; i += 25) { XYSource.Add(new ComXYInputDataSource() { C0 = i }); } } XYSource.Add(new ComXYInputDataSource() { C0 = -1 }); #endregion } DContextMain.CYL1 = cYL1; DContextMain.CYL2 = cYL2; Messenger.Default.Send <ComXYInputMainDataSource>((DContextMain), USysMessages.XYColumnShow); }
private void dds_LoadedData(object sender, LoadedDataEventArgs e) { this.IsBusyCW = false; if (e.HasError) { e.MarkErrorAsHandled(); return; } if (e.TotalEntityCount <= 0) { XYSource.Clear(); return; } V_B_Material_LensSmart _Rs = e.Entities.FirstOrDefault() as V_B_Material_LensSmart; this.DContextMain.LensCodeSelected = _Rs.LensCode; this.DContextMain.LensNameSelected = _Rs.LensName; this.DContextMain.F_LR = _Rs.F_LR ?? false; this.DContextMain.F_CA = _Rs.F_CA ?? false; if (this.DContextMain.F_LR) { this.IsReadOnlyLR = false; } else { this.IsReadOnlyLR = true; this.DContextMain.LR = ""; } if (this.DContextMain.F_CA) { this.CYL = "ADD"; this.ADDInput = "CYL:"; } else { this.CYL = "CYL"; this.ADDInput = "ADD:"; } if (this.DContextMain.F_LR && string.IsNullOrEmpty(this.DContextMain.LR)) { this.DContextMain.LR = "R"; } var _SPH1 = _Rs.SPH1; var _SPH2 = _Rs.SPH2; var _CYL1 = _Rs.CYL1; var _CYL2 = _Rs.CYL2; if (this.DContextMain.F_LR) { _CYL1 = _Rs.X_ADD1; _CYL2 = _Rs.X_ADD2; } this.LoadXY(_SPH1.Value, _SPH2.Value, _CYL1.Value, _CYL2.Value); }
private void XYLoad() { var _LensCodeInput = this.DContextMain.LensCode.MyStr(); //this.IsShowWhCode = Visibility.Collapsed; //this.IsShowLR = Visibility.Collapsed; this.CYL = "CYL"; var _Rs = ComHelpLensCode.UHV_B_Material_LensSmart.Where(item => item.LensCode.ToUpper().Trim() == _LensCodeInput).FirstOrDefault(); if (_Rs == null) { MessageErp.ErrorMessage(ErpUIText.Get("Err_LensCodeMiss") + _LensCodeInput); XYSource.Clear(); return; } this.DContextMain.LensCodeSelected = _Rs.LensCode; this.DContextMain.LensNameSelected = _Rs.LensName; this.DContextMain.F_LR = _Rs.F_LR.Value; this.DContextMain.F_CA = _Rs.F_CA.Value; if (_Rs.F_LR.Value) { } else { this.DContextMain.LR = ""; } if (_Rs.F_CA.Value) { this.CYL = "ADD"; } else { this.CYL = "CYL"; } if (_Rs.F_LR.Value && string.IsNullOrEmpty(this.DContextMain.LR)) { this.DContextMain.LR = "R"; } var _SPH1VS = 0; var _SPH2VS = 0; var _CYL1VS = 0; var _CYL2VS = 0; var _X_ADD1VS = 0; var _X_ADD2VS = 0; try { _SPH1VS = Convert.ToInt32(this.ObservableCollectionXY.Min(it => it.SPH).ToString()); } catch { } try { _SPH2VS = Convert.ToInt32(this.ObservableCollectionXY.Max(it => it.SPH).ToString()); } catch { } try { _CYL1VS = Convert.ToInt32(this.ObservableCollectionXY.Min(it => it.CYL).ToString()); } catch { } try { _CYL2VS = Convert.ToInt32(this.ObservableCollectionXY.Max(it => it.CYL).ToString()); } catch { } try { _X_ADD1VS = Convert.ToInt32(this.ObservableCollectionXY.Min(it => it.X_ADD).ToString()); } catch { } try { _X_ADD2VS = Convert.ToInt32(this.ObservableCollectionXY.Max(it => it.X_ADD).ToString()); } catch { } var _SPH1 = _SPH1VS; var _SPH2 = _SPH2VS; var _CYL1 = _CYL1VS; var _CYL2 = _CYL2VS; if (_Rs.F_LR.Value) { _CYL1 = _X_ADD1VS; _CYL2 = _X_ADD2VS; } if (_SPH1 > 0) { _SPH1 = 0; } else if (_SPH2 < 0) { _SPH2 = 0; } else { } if (_CYL1 > 0) { _CYL1 = 0; } else if (_CYL2 < 0) { _CYL2 = 0; } else { } this.LoadXY(_SPH1, _SPH2, _CYL1, _CYL2); }