private Shape GetNewShapeBasedOnType(EditState state, float lineWidth, Color penColor) { Shape shape = null; Color color = Color.FromArgb(ShapeOpacity, penColor); switch (state) { case EditState.PEN: break; case EditState.CIRCLE: shape = new MyCircle(lineWidth, color, Point.Empty, Point.Empty); break; case EditState.RECTANGLE: shape = new MyRectangle(lineWidth, color, Point.Empty, Point.Empty); break; case EditState.ARROW: shape = new Arrow(color, Point.Empty, Point.Empty); Arrow temp = shape as Arrow; temp.ArrowWidth = ArrowSize; break; case EditState.LINE: shape = new Line(lineWidth, color, Point.Empty, Point.Empty); break; case EditState.CROP: case EditState.NONE: default: break; } return(shape); }
/// <summary> /// 选中科室切换科室诊断列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeList_Detp_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (e.Node == null) { return; } if (e.Node.Focused) { TreeListNode node = e.Node; string deptid = e.Node.GetValue("ID").ToString(); if (m_EditState == EditState.Edit) { if (m_app.CustomMessageBox.MessageShow(string.Format("您有数据未保存,是否保存?"), CustomMessageBoxKind.QuestionYesNo) == DialogResult.Yes) { DoSave(deptid); } } GetDeptDiag(deptid); m_EditState = EditState.View; m_DeptID = deptid; } }
private ReactiveCommand GetCommandPersonalAccount(EditState editState, IObservable <bool> canExecute = null) { var command = new ReactiveCommand(canExecute); command.RegisterAsyncFunction(_ => this.PreparingEditablePersonalAccount(editState)) .ObserveOnUiSafeScheduler() .Subscribe( result => { var viewModel = this._routableViewModelManager.Get <IEditablePersonalAccountViewModel>(); result.CountByDocument = _selectedPlanCertificate.CountByDocument; if ((!string.IsNullOrWhiteSpace(this.SelectedPlanReceiptOrder.MemoContractor)) && (result.PersonalAccount == null)) { viewModel.UserContractor = new UserDto { TableNumber = SelectedPlanReceiptOrder.MemoContractor }; } result.CountFact = _selectedPlanCertificate.CountFact; viewModel.SetEditableObject(result, editState); viewModel.Measure = this.SelectedPlanCertificate.Measure; HostScreen.Router.Navigate.Execute(viewModel); }); command.ThrownExceptions.Subscribe(this.OnError); command.IsExecuting.Subscribe(isExecuting => IsBusy = isExecuting); return(command); }
/// <summary> /// 编辑操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DevButtonEdit_Click(object sender, EventArgs e) { m_EditState = EditState.Edit; //gridControl1.Enabled = false; BtnState("1"); this.memoDESC.Focus(); }
void mapView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (_editState == EditState.Move) { _editState = EditState.None; } }
/// <summary> /// 点击列表看详细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridControl1_Click(object sender, EventArgs e) { GridHitInfo hitInfo = gViewBabyInfo.CalcHitInfo(gridControl1.PointToClient(Cursor.Position)); if (hitInfo.RowHandle < 0) { return; } if (gViewBabyInfo.FocusedRowHandle < 0) { return; } DataRow foucesRow = gViewBabyInfo.GetDataRow(gViewBabyInfo.FocusedRowHandle); if (foucesRow == null) { return; } SetPageValue(SetEntityByDataRow(foucesRow)); m_EditState = EditState.Edit; BtnState(); }
private string MNoOfPat = string.Empty;//母亲的病案首页序号 /// <summary> /// 新增操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnADD_Click(object sender, EventArgs e) { try { if (grdViewPat.FocusedRowHandle < 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条病人记录"); return; } m_EditState = EditState.Add; oldFocusRowHandle = grdViewPat.FocusedRowHandle; DataRow foucesRow = grdViewPat.GetDataRow(grdViewPat.FocusedRowHandle); oldName = foucesRow["PatName"].ToString(); MNoOfPat = foucesRow["NOOFINPAT"].ToString(); if (oldName.Contains("婴儿")) { oldName = oldName.Substring(0, oldName.IndexOf('【')); } //ClearPageValue(); deBirth.DateTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //默认给今天出生日期精确的时分 this.txtAge.Text = "0岁"; //CalcDisplayAge(deBirth.DateTime, DateTime.Now); this.txtName.Text = oldName + "之"; //仁和需求,婴儿姓名默认为“母亲姓名”+“之” lueSex.CodeValue = ""; //oldName=grdViewPa BtnState(); this.lueSex.Focus(); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 窗体加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SetPatientsBaby_Load(object sender, EventArgs e) { InitLueSex(); LoadBabyInfo(); //加载婴儿信息 LoadPatInfo(); //加载病人信息 //this.txtPatName.Text = PATNAME; //有婴儿的这边后处理下 if (PATNAME.Contains("婴儿")) { this.txtPatName.Text = PATNAME.Substring(0, PATNAME.IndexOf('【')); } else { this.txtPatName.Text = PATNAME; } try { SetGridDataBySea();//默认显示上级页面选择的患者 } catch (Exception ex) { m_app.CustomMessageBox.MessageShow("错误信息:" + ex.Message); return; } //更改出生日期后,年龄算出来(ywk) deBirth.EditValueChanged += new EventHandler(deBirth_EditValueChanged); m_EditState = EditState.View; BtnState(); this.ActiveControl = txtPatName; }
async void mapView_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (_editState == EditState.Create || _editState == EditState.Tool || _editState == EditState.Edit) { return; } if (_editState == EditState.None) { // hit test on message layer if (_militaryMessageLayer != null) { ClearSelectedMessage(); var graphic = await HitTestMessageLayerAsync(e); if (graphic != null) { _pointOffset = GetMessageOffset(graphic, e.GetPosition(_mapView)); SelectMessageGraphic(graphic); _editState = EditState.Move; _mapView.ReleaseMouseCapture(); } } } }
void DisplayItems() { if (selectedType != null) { //for(int i = 0; i < InventoryDatabase.ElementCount; i++) for (int i = 0; i < selectedType.elementIDs.Count; i++) { InventoryElement item = InventoryDatabase.GetElement(selectedType.elementIDs[i]); if (item != null) { if (item.type != null) { //if(selectedType.ID == item.type.ID) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(item.name, GUILayout.ExpandWidth(true))) { GUI.FocusControl(null); editItem = item; editState = EditState.EDITITEM; } EditorGUILayout.EndHorizontal(); } } } } } }
void OnGUI() { EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); ListArea(); MainArea(); EditorGUILayout.EndHorizontal(); if (Application.isPlaying) { editState = EditState.PLAYING; } if (GUI.changed) { EditorUtility.SetDirty(InventoryDatabase.Instance); if (prefab == null) { prefab = Resources.Load("InventoryDatabase") as GameObject; } if (prefab != null) { PrefabUtility.ReplacePrefab(InventoryDatabase.Instance.gameObject, prefab, ReplacePrefabOptions.ConnectToPrefab); } } this.Repaint(); }
public void MouseClick(Point e, Input.MouseButton b) { if ((Control.ModifierKeys & Keys.Shift) != 0) { int x = e.X; int y = e.Y; ScreenToTile(ref x, ref y); p1.X = x; p1.Y = y; #if false if ((e.Button & MouseButtons.Left) != 0) { #endif if (state == EditState.Pasting) { // left click while pasting to cancel state = EditState.DoingNothing; return; } state = EditState.Copying; p2.X = x; p2.Y = y; #if false } else if ((e.Button & MouseButtons.Right) != 0 && curselection != null) { state = EditState.Pasting; p2.X = x + curselection.GetLength(0); p2.Y = y + curselection.GetLength(1); } #endif } }
/// <summary> /// 编辑事件 /// edit by Yanqiao.Cai 2012-11-06 /// 1、add try ... catch /// 2、添加提示 /// 3、添加焦点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnEdit_Click(object sender, EventArgs e) { try { if (gridView1.FocusedRowHandle < 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条记录"); return; } DataRow foucesRow = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (foucesRow == null || foucesRow.IsNull("ID")) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条记录"); return; } SetPageValue(SetEntityByDataRow(foucesRow)); m_EditState = EditState.Edit; BtnState(); this.txtMapID.Focus(); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
/// <summary> /// 删除事件 /// edit by Yanqiao.Cai 2012-11-06 /// 1、add try ... catch /// 2、添加提示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButtonDelete_Click(object sender, EventArgs e) { try { if (imageListBoxControl1.SelectedItems.Count <= 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一个特殊字符"); return; } if (DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("您确定要删除特殊字符 " + (imageListBoxControl1.SelectedItem as ListBoxItem).Value + " 吗?", "删除特殊字符", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.OkCancel) == DialogResult.Cancel) { return; } Symbol symbol = GetFormSymbol(); m_SqlHelp.DeleteSymbol(symbol); RefreshSymbol(); m_state = EditState.None; this.FreshView(); Host.CustomMessageBox.MessageShow("删除成功", Core.CustomMessageBoxKind.InformationOk); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
private void button2_Click(object sender, EventArgs e) { try { if(textBox1.Text == "" || comboBox1.Text == "") { throw new Exception(); } //TODO: Sprawdzanie obecności wymaganych pól SetValues(); ioHandler.WriteXMLFile(); UpdateListBox1(); ClearPanel1(); editState = EditState.None; panel1.Enabled = false; } catch (Exception ex) { MessageBox.Show("Insufficent data\r\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void SetFormState(EditState setState) { bool isAllowEdit = (setState != EditState.Viewing); cmbBranch.Enabled = isAllowEdit; cmbSupplier.Enabled = isAllowEdit; dtpBillDate.Enabled = isAllowEdit; txtBillRemark.ReadOnly = !isAllowEdit; dcbDiscount.ReadOnly = !isAllowEdit; cmbKeyInEmp.Visible = isAllowEdit; txtkeyInEmpName.Visible = !isAllowEdit; txtUpdated.Visible = !isAllowEdit; cmbCheckEmpView.Visible = !isAllowEdit; cmbCheckEmpEdit.Visible = isAllowEdit; cmbBarcodeEmpView.Visible = !isAllowEdit; cmbBarcodeEmpEdit.Visible = isAllowEdit; cmbBarcodeEmp2View.Visible = !isAllowEdit; cmbBarcodeEmp2Edit.Visible = isAllowEdit; cmbModelInfoEmpView.Visible = !isAllowEdit; cmbModelInfoEmpEdit.Visible = isAllowEdit; btnAdd.Visible = !isAllowEdit; btnEdit.Visible = !isAllowEdit; btnDelete.Visible = !isAllowEdit; okBillPanel.Visible = isAllowEdit; dgvBuyView.Visible = (setState != EditState.Adding); billState = setState; }
/// <summary> /// 编辑事件 /// edit by Yanqiao.Cai 2012-11-06 /// add try ... catch /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButtonModify_Click(object sender, EventArgs e) { try { if (gridViewMacro.FocusedRowHandle < 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条记录"); return; } DataRow dr = gridViewMacro.GetDataRow(gridViewMacro.FocusedRowHandle); if (null == dr) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条记录"); return; } SetTextValue(dr); m_state = EditState.Edit; this.FreshView(); this.textEditName.Focus(); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
public bool SetValue(string fieldName, object value) { if (this._rowInfo == null) { return(false); } try { int position = this._rowInfo.FieldIndex(fieldName); if (position == -1) { return(false); } this._rowInfo.SetValue(position, value); if (this._state != EditState.NotSave) { this._state = EditState.NotSave; } return(true); } catch (Exception exception) { return(false); } }
/// <summary> /// 删除字典分类事件 /// edit by Yanqiao.Cai 2012-11-06 /// 1、add try ... catch /// 2、添加提示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButtonDictionaryDelete_Click(object sender, EventArgs e) { try { if (gridViewDictionary.FocusedRowHandle < 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条字典分类记录"); return; } DataRow dr = gridViewDictionary.GetDataRow(gridViewDictionary.FocusedRowHandle); if (null == dr || null == dr["NAME"]) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条字典分类记录"); return; } if (DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("您确定要删除字典分类 " + dr["NAME"] + " 吗?", "删除字典分类", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.OkCancel) == DialogResult.Cancel) { return; } Dictionary dict = GetFormDictionary(); m_SqlHelp.DeleteDictionary(dict); RefreshDictionary(); m_state = EditState.None; this.FreshView(); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
public void ToolMouseDown(object sender, MouseEventArgs e) { this.xInitial = e.X; this.yInitial = e.Y; int flag = 0; if (currentObject != null && !multiselectProcess) { currentObject.ChangeState(StaticState.GetInstance()); } foreach (DrawingObject obj in this.canvas.GetListObjects().Reverse <DrawingObject>()) { if (obj.intersect(e.Location)) { if (!multiselectProcess) { memberGroup.Clear(); } else { if (!memberGroup.Any()) { memberGroup.Add(this.currentObject); } memberGroup.Add(obj); } this.currentObject = obj; obj.ChangeState(EditState.GetInstance()); break; } } }
/// <summary> 构造函数 </summary> public CurrentEditState(BlockTable bt, BlockTableRecord currentBtr, EditState editState) { CurrentBTR = currentBtr; EditState = editState; // BlockTable = bt; }
public Form1() { InitializeComponent(); ioHandler = new IOHandler("..\\..\\..\\Content\\Resources\\GameObjectStats.xml"); //very, VERY creepy comboBox1.Items.AddRange(new object[] {"Vehicle", "Infantry", "Building", "StaticObject", "Civilian"}); editState = EditState.None; }
public void ToolMouseDown(object sender, MouseEventArgs e) { point = e.Location; if (e.Button == MouseButtons.Left && canvas != null) { if (selectedObject == null) { canvas.DeselectAllObjects(); tempGroup.Clear(); } else if (!multiSelect) { selectedObject.ChangeState(StaticState.GetInstance()); } selectedObject = canvas.SelectObjectAt(e.X, e.Y); if (selectedObject != null) { selectedObject.ChangeState(EditState.GetInstance()); if (multiSelect) { tempGroup.Add(selectedObject); } } } else if (e.Button == MouseButtons.Right) { canvas.RemoveDrawingObject(this.selectedObject); } }
/// <summary> /// /// </summary> /// <param name="aControl"></param> /// <param name="status"></param> /// <param name="bRecursion"></param> /// <param name="mode"></param> public static void RefreshControl(Control aControl, EditState status, bool bRecursion = true, RefreshMode mode = RefreshMode.Normal) { if (aControl == null) return; Color colorTrue = Color.White; Color colorFalse = Color.WhiteSmoke; //正常的是编辑状态下可用 bool bInEdit = status.In(EditState.Edit, EditState.AddNew); bool bControlEnabled = mode == RefreshMode.Normal ? bInEdit : !bInEdit; if (aControl is GridControl) { //Grid列按列自身的RefreshMode处理 GridControl grid = aControl as GridControl; GridView view = grid.MainView as GridView; switch (mode) { //反向Grid,一般用于索引数据,如Index case RefreshMode.Unnatural: RefreshControl(grid, !bInEdit); break; //正向Grid,一般用于主数据 case RefreshMode.Normal: RefreshControl(view, bControlEnabled); break; default: break; } } else if (bRecursion && (aControl is PanelControl || aControl is LayoutControl || aControl is SplitGroupPanel || aControl is Form || aControl is XtraTabPage || aControl is XtraTabControl || aControl is BaseUserControl || aControl is SplitContainerControl)) { foreach (Control c in aControl.Controls) { RefreshControl(c, status, bRecursion, mode); } } else RefreshControl(aControl, bControlEnabled, colorTrue, colorFalse); }
private void ButtonChange_Click(object sender, EventArgs e) { var currentRow = dataGridViewDB.SelectedRows[0]; textBoxREAL.Text = currentRow.Cells["REAL"].Value.ToString(); textBoxIND.Text = currentRow.Cells["IND"].Value.ToString(); textBoxNNP.Text = currentRow.Cells["NNP"].Value.ToString(); textBoxADR.Text = currentRow.Cells["ADR"].Value.ToString(); textBoxRKC.Text = currentRow.Cells["RKC"].Value.ToString(); textBoxNAMEP.Text = currentRow.Cells["NAMEP"].Value.ToString(); textBoxNAMEN.Text = currentRow.Cells["NAMEP"].Value.ToString(); textBoxNEWNUM.Text = currentRow.Cells["NEWNUM"].Value.ToString(); textBoxTELEF.Text = currentRow.Cells["TELEF"].Value.ToString(); textBoxREGN.Text = currentRow.Cells["REGN"].Value.ToString(); textBoxOKPO.Text = currentRow.Cells["OKPO"].Value.ToString(); textBoxDT_IZM.Text = currentRow.Cells["DT_IZM"].Value.ToString(); textBoxDATE_IN.Text = currentRow.Cells["DATE_IN"].Value.ToString(); textBoxDATE_CH.Text = currentRow.Cells["DATE_CH"].Value.ToString(); SelectActualValue(comboBoxPZN, currentRow.Cells["PZN_NAME"].Value.ToString()); SelectActualValue(comboBoxREG, currentRow.Cells["RGN_NAME"].Value.ToString()); SelectActualValue(comboBoxTNP, currentRow.Cells["FULL_NAME"].Value.ToString()); SelectActualValue(comboBoxUER, currentRow.Cells["UER_NAME"].Value.ToString()); panelEdit.Visible = true; dataGridViewDB.Enabled = false; editState = EditState.edit; }
/// <summary> /// 刷新页面数据 /// </summary> private void RefreshData() { BindGrid(); m_EditState = EditState.View; BtnState(); ClearPageValue(); }
/// <summary> /// 编辑事件 /// edit by Yanqiao.Cai 2012-11-07 /// 1、add try ... catch /// 2、添加焦点 /// 3、逻辑优化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnTypeEdit_Click(object sender, EventArgs e) { try { if (gridView1.FocusedRowHandle < 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条记录"); return; } DataRow dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (null == dr || dr.IsNull("ID") || dr.ItemArray.Length <= 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条记录"); return; } SetPageValue(SetEntityByDataRow(dr)); SetPageValueByDataRow(dr); m_EditState = EditState.Edit; BtnState(); this.txtMapID.Focus(); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
private void SetEditState(ITextualView v) { if (State == EditState.TextEditing) { // We're done with any old editing operation ResetTextEditState(); } editedTextView = v; ITextualBlock model = (ITextualBlock)v.Model; editedTextModel = model; originalEditedText = model.Text; TextBox tb = textBoxMaker(); editedTextBox = tb; tb.Text = model.Text; PositionTextBox(tb, v.AbsoluteBounds()); tb.TextChanged += new EventHandler(argTextBox_TextChanged); tb.KeyDown += new KeyEventHandler(argTextBox_KeyDown); tb.Show(); tb.Select(); ShowEraseButton(v); State = EditState.TextEditing; }
/// <summary> /// 刷新病历预览区 /// </summary> /// <param name="model">病历</param> /// <param name="editState">状态</param> public void RefreashEmrView(EmrModel model, EditState editState) { try { if (null == model || null == m_CurrentModel) { return; } ///刷新预览区 var preViewArray = m_TempDailyPreViewCollection.FirstOrDefault(p => !string.IsNullOrEmpty(m_CurrentModel.DeptChangeID) && p.Key == m_CurrentModel.DeptChangeID); if (null != preViewArray.Value && null != preViewArray.Value.PreViewInner) { if (editState == EditState.Add || editState == EditState.Edit) {///保存 preViewArray.Value.PreViewInner.AfterSaveEmr(m_CurrentModel.InstanceId.ToString(), m_CurrentModel.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss")); } else if (editState == EditState.Delete) {///删除 preViewArray.Value.PreViewInner.AfterDeleteEmr(m_CurrentModel.InstanceId.ToString()); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// 取消操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnClear_Click(object sender, EventArgs e) { ClearPageValue("1"); m_EditState = EditState.View; BtnState("1"); //gridControl1.Enabled = true; }
/// <summary> /// 刷新 /// </summary> private void RefreshData() { InitSateData(); m_EditState = EditState.View; BtnState(); ClearPageValue(); }
/// <summary> /// 编辑事件 /// edit by Yanqiao.Cai 2012-11-06 /// 1、add try ... catch /// 2、添加提示 /// 3、添加焦点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButtonEdit_Click(object sender, EventArgs e) { try { if (imageListBoxControl1.SelectedItems.Count <= 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一个特殊字符"); return; } ListBoxItem lbi = imageListBoxControl1.SelectedItem as ListBoxItem; if (null == lbi) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一个特殊字符"); return; } this.textEditSymbol.Text = null == lbi.Value ? "" : lbi.Value.ToString(); m_state = EditState.Edit; this.FreshView(); this.simpleButtonAdd.Focus(); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
private async void HandleGenerationCompleted(GenerateGeodatabaseJob job) { JobStatus status = job.Status; // If the job completed successfully, add the geodatabase data to the map. if (status == JobStatus.Succeeded) { // Clear out the existing layers. myMapView.Map.OperationalLayers.Clear(); // Loop through all feature tables in the geodatabase and add a new layer to the map. foreach (GeodatabaseFeatureTable table in _resultGdb.GeodatabaseFeatureTables) { // Skip non-point tables. await table.LoadAsync(); if (table.GeometryType != GeometryType.Point) { continue; } // Create a new feature layer for the table. FeatureLayer layer = new FeatureLayer(table); // Add the new layer to the map. myMapView.Map.OperationalLayers.Add(layer); } // Enable editing features. _readyForEdits = EditState.Ready; // Update the help label. myHelpLabel.Text = "2. Tap a point feature to select"; } // See if the job failed. if (status == JobStatus.Failed) { // Create a message to show the user. string message = "Generate geodatabase job failed"; // Show an error message (if there is one). if (job.Error != null) { message += ": " + job.Error.Message; } else { // If no error, show messages from the job. foreach (JobMessage m in job.Messages) { // Get the text from the JobMessage and add it to the output string. message += "\n" + m.Message; } } // Show the message. ShowStatusMessage(message); } }
/// <summary> /// 编辑字典明细事件 /// edit by Yanqiao.Cai 2012-11-06 /// 1、add try ... catch /// 2、添加提示 /// 3、添加焦点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButtonModifyDetail_Click(object sender, EventArgs e) { try { if (gridViewDictionaryDetail.FocusedRowHandle < 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条字典记录"); return; } DataRow dr = gridViewDictionaryDetail.GetDataRow(gridViewDictionaryDetail.FocusedRowHandle); if (null == dr) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请选择一条记录"); return; } this.textEditDictionaryDetailName.Text = null == dr["NAME"] ? "" : dr["NAME"].ToString(); this.textEditDictionaryDetailCode.Text = null == dr["CODE"] ? "" : dr["CODE"].ToString(); m_stateDetail = EditState.Edit; this.FreshView(); this.textEditDictionaryDetailName.Focus(); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
private void AddRecordToHistory(EditState editState, Account.Account executor) { ChangeState changeState; switch (editState) { case EditState.Editable: changeState = ChangeState.Unlocked; break; case EditState.EditLocked: changeState = ChangeState.Locked; break; default: throw new InvalidOperationException("EditState is not defined."); } EditChangeHistoryRecords.Add(new EditChangeHistoryRecord(changeState, executor)); }
public EditStateCommand(Action<object, EditState> execute, EditState editState, Func<object, EditState, bool> canEnterState, Predicate<object> canExecute) { if (execute == null) { throw new ArgumentNullException("execute"); } if (editState == EditState.None) { throw new ArgumentException("editState parameter cannot be None"); } if (canEnterState == null) { throw new ArgumentNullException("canEnterState"); } _execute = execute; EditState = editState; _canEnterState = canEnterState; _canExecute = canExecute; }
public EditProcDefController(ProcDefView view, ProcDefBlock model, BlockViewFactory factory, Func<TextBox> textBoxMaker, Button eraseButton) { this.view = view; this.view.Changed += new ViewChangedEvent(view_Changed); this.model = model; this.factory = factory; this.textBoxMaker = textBoxMaker; this.eraseButton = eraseButton; this.eraseButton.Hide(); this.eraseButton.Click += new EventHandler(eraseButton_Click); this.Changed += delegate(object sender) { }; State = EditState.Ready; // I wish the view was dynamically centered, but there's some mismatch // between a label's textbox and the place where the text is drawn // for now we hide it by not constantly moving the view // strangely, the mistmatch disappears (text is drawn in the right place) // when view.RelativePos is not moved anymore. hmm... // Point origin = size.Center(b.Size); Point origin = new Point(15, 15); view.RelativePos = origin; }
/// <summary> /// On this command the currently selected geometry gets edited if it is a polyline or polygon /// Updates the military message with the new geometry during and after editing /// </summary> /// <param name="obj"></param> private async void DoEditGeometry(object obj) { if (_mapView.Editor.IsActive) { if (_mapView.Editor.Complete.CanExecute(null)) { _mapView.Editor.Complete.Execute(null); _editState = EditState.None; return; } } if (_currentMessage != null) { var tam = _mission.MilitaryMessages.FirstOrDefault(msg => msg.Id == _currentMessage.Id); if (tam != null) { _editState = EditState.Edit; try { var progress = new Progress<GeometryEditStatus>(); progress.ProgressChanged += (a, ges) => { UpdateCurrentMessage(tam, ges.NewGeometry); }; _beforeEditGeometry = tam.SymbolGeometry; var resultGeometry = await _mapView.Editor.EditGeometryAsync(tam.SymbolGeometry, null, progress); if (resultGeometry != null) { tam.SymbolGeometry = resultGeometry; UpdateCurrentMessage(tam, resultGeometry); } } catch { // ignored } } } }
/// <summary> /// IDragable.Drop /// Method called when an object of a valid type is dropped on the Map /// The data is a SymbolTreeViewModel along with the DragEventArgs /// </summary> /// <param name="data"></param> /// <param name="e"></param> public void Drop(object data, DragEventArgs e) { var stvm = data as SymbolTreeViewModel; if (stvm != null) { AddNewMessage(stvm.ItemSVM, e.GetPosition(_mapView), stvm.GUID); } Mediator.NotifyColleagues(Constants.ACTION_DRAG_DROP_ENDED, data); _editState = EditState.None; }
/// <summary> /// 初始化逻辑数据 /// </summary> /// <param name="fileName">文件路径</param> /// <param name="currentEditState">当前编辑状态</param> private void InitData(string fileName, EditState currentEditState) { IniReader iniReader = new IniReader(fileName); switch (currentEditState) { case EditState.LeftReady: { leftLogicalData = new LogicalData(iniReader, fileName) ; break; } case EditState.RightReady: { rightLogicalData = new LogicalData(iniReader, fileName); break; } } }
/// <summary> /// 打开目标对比文件 /// </summary> /// <param name="fileName">文件路径</param> private void OpenRightFile(string fileName) { InitData(fileName, EditState.RightReady); // 等待数据初始化完毕 while (!rightLogicalData.IsReady) { ; } richTextBox2.Text = rightLogicalData.Content; richTextBox2.SelectionStart = 0; richTextBox2.SelectionLength = rightLogicalData.Content.Length; richTextBox2.SelectionColor = Color.Black; switch (editState) { case EditState.None: { editState = EditState.RightReady; this.Text = string.Format("MapLogical文件比较 <-> {0}", rightLogicalData.FileName); break; } case EditState.LeftReady: { editState = EditState.AllReady; this.Text = string.Format("MapLogical文件比较 {0} <-> {1}", leftLogicalData.FileName, rightLogicalData.FileName); CompareFile(); break; } case EditState.RightReady: { break; } case EditState.AllReady: { CompareFile(); break; } } }
public EditPosition (MaskedTextProvider Parent, EditType Type, EditState State, char MaskCharacter) { this.Type = Type; this.Parent = Parent; this.State = State; this.MaskCharacter = MaskCharacter; }
override public void OnInspectorGUI() { EditorGUILayout.BeginVertical(); { NavEditAreaGroup group = NavEditAreaManager.sInstance.GetGroup(this.m_cNavMono.m_iSelGroup); NavEditArea area = null; if( group != null) { area = group.GetArea(this.m_cNavMono.m_iSelArea); } //========================= groups ============================= GUILayout.BeginVertical(); { GUILayout.Label("All Groups"); groupUIPos = GUILayout.BeginScrollView( groupUIPos ,GUILayout.Height(150)); { List<string> lst = new List<string>(); for(int i = 0 ; i<NavEditAreaManager.sInstance.m_lstAreaGroup.Count ; i++) { lst.Add( "Group(" + i.ToString() + ")" ); } this.m_cNavMono.m_iSelGroup = GUILayout.SelectionGrid( this.m_cNavMono.m_iSelGroup, lst.ToArray(),1); if( m_iLastSelGroup != this.m_cNavMono.m_iSelGroup ) { m_iLastSelGroup = this.m_cNavMono.m_iSelGroup; this.m_cNavMono.m_iSelArea = 0; this.m_cNavMono.m_iSelPoint = 0; //FocusEditPanel(); } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); { if( GUILayout.Button("Create Group")) { Debug.Log("create group"); NavEditAreaManager.sInstance.AddGroup(); this.m_cNavMono.m_iSelGroup = NavEditAreaManager.sInstance.m_lstAreaGroup.Count-1; } if( GUILayout.Button("Delete Group")) { Debug.Log("delete group"); NavEditAreaManager.sInstance.RemoveGroup(this.m_cNavMono.m_iSelGroup); this.m_cNavMono.m_iSelGroup--; if(this.m_cNavMono.m_iSelGroup < 0) this.m_cNavMono.m_iSelGroup = 0; this.m_cNavMono.m_iSelArea = 0; this.m_cNavMono.m_iSelPoint = 0; } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); //======================== areas ======================== GUILayout.BeginVertical(); { GUILayout.Label("All Areas"); areaUIPos = GUILayout.BeginScrollView( areaUIPos ,GUILayout.Height(150)); { if(group != null ) { List<string> lst = new List<string>(); for(int i = 0 ; i< group.m_lstArea.Count ; i++) { lst.Add( "Area(" + i.ToString() + ")" ); } this.m_cNavMono.m_iSelArea = GUILayout.SelectionGrid( this.m_cNavMono.m_iSelArea, lst.ToArray(),1); if( m_iLastSelArea != this.m_cNavMono.m_iSelArea ) { m_iLastSelArea = this.m_cNavMono.m_iSelArea; this.m_cNavMono.m_iSelPoint = 0; } // FocusEditPanel(); } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); { GUI.enabled = group != null; if( GUILayout.Button("Create Frame Area")) { Debug.Log("create frame area"); group.CreateFrameArea(); this.m_cNavMono.m_iSelArea = 0; this.m_cNavMono.m_iSelPoint = 0; } if( GUILayout.Button("Create Area")) { Debug.Log("create area"); group.CreateArea(); this.m_cNavMono.m_iSelArea = group.m_lstArea.Count-1; this.m_cNavMono.m_iSelPoint = 0; } if( GUILayout.Button("Delete Area")) { Debug.Log("delete area"); group.RemoveArea(this.m_cNavMono.m_iSelArea); this.m_cNavMono.m_iSelArea--; if(this.m_cNavMono.m_iSelArea < 0 ) this.m_cNavMono.m_iSelArea = 0; this.m_cNavMono.m_iSelPoint = 0; } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); //====================== points ============================== GUILayout.BeginVertical(); { GUILayout.Label("All Points"); pointUIPos = GUILayout.BeginScrollView( pointUIPos ,GUILayout.Height(150)); { if(group != null && area != null) { List<string> lst = new List<string>(); for(int i = 0 ; i< area.m_lstPoints.Count ; i++) { lst.Add( "Point(" + i + ")"); } this.m_cNavMono.m_iSelPoint = GUILayout.SelectionGrid( this.m_cNavMono.m_iSelPoint, lst.ToArray(),1); // FocusEditPanel(); } } GUILayout.EndScrollView(); GUI.enabled = m_eState != EditState.StateEditArea; if(GUILayout.Button("Editor Point",GUILayout.Height(30))) { m_eState = EditState.StateEditArea; } GUI.enabled = m_eState != EditState.StateFindArea; if(GUILayout.Button("Find Path",GUILayout.Height(30))) { m_eState = EditState.StateFindArea; } GUI.enabled = (m_eState == EditState.StateEditArea || m_eState == EditState.StateFindArea); if(GUILayout.Button("Finish Point",GUILayout.Height(30))) { m_eState = EditState.StateFinishArea; } if(GUILayout.Button("Delete Point",GUILayout.Height(30))) { Debug.Log("delete point"); if(area != null ) { area.RemoveAt(this.m_cNavMono.m_iSelPoint); this.m_cNavMono.m_iSelPoint--; if(this.m_cNavMono.m_iSelPoint < 0 ) this.m_cNavMono.m_iSelPoint = 0; } } GUI.enabled = true; } GUILayout.EndVertical(); //===================== ============================ } EditorGUILayout.EndVertical(); GUILayout.Label("NavMesh"); this.m_cNavMono.m_bShowMesh = GUILayout.Toggle(this.m_cNavMono.m_bShowMesh , "NavMesh Show"); this.m_cNavMono.m_bShowArea = GUILayout.Toggle(this.m_cNavMono.m_bShowArea , "Area Show"); if( GUILayout.Button("Create NavMesh",GUILayout.Height(30))) { this.m_cNavMono.CreateNavMesh(); } GUILayout.Label("Area Group Save/Load"); GUILayout.BeginHorizontal(); { if( GUILayout.Button("Save AreaGroup",GUILayout.Height(30))) { Debug.Log("save area group"); string pathfile = EditorUtility.SaveFilePanel("Save Area Group" , Application.dataPath , "map" , UNWALK_EXTENSION); NavEditAreaManager.sInstance.SaveAreaGroup(pathfile); } if( GUILayout.Button("Load AreaGroup",GUILayout.Height(30))) { Debug.Log("load area group"); string pathfile = EditorUtility.OpenFilePanel("Open Area Group" , Application.dataPath , UNWALK_EXTENSION); NavEditAreaManager.sInstance.LoadAreaGroup(pathfile , m_cParent); } } GUILayout.EndHorizontal(); GUILayout.Label("NavMesh Save/Load"); GUILayout.BeginHorizontal(); { if(GUILayout.Button("Save NavMesh",GUILayout.Height(30))) { Debug.Log("save navmesh"); string pathfile = EditorUtility.SaveFilePanel("Save NavMesh" , Application.dataPath , "map" , NAVMESH_EXTENSION); this.m_cNavMono.SaveNavMesh(pathfile); } if(GUILayout.Button("Load NavMesh",GUILayout.Height(30))) { Debug.Log("load navmesh"); string pathfile = EditorUtility.OpenFilePanel("Open NavMesh" , Application.dataPath , NAVMESH_EXTENSION); this.m_cNavMono.LoadNavMesh(pathfile); } } GUILayout.EndHorizontal(); }
public EditItem(String name, EditState state) : base(name) { State = state; }
private void button3_Click(object sender, EventArgs e) { ClearPanel1(); panel1.Enabled = false; editState = EditState.None; ioHandler.Reset(); }
private void button4_Click(object sender, EventArgs e) { if(listBox1.Items.Count > 0 && listBox1.SelectedIndex >=0) { selectedToEdit = listBox1.SelectedIndex; FillPanel1(selectedToEdit); editState = EditState.Editing; panel1.Enabled = true; } }
public void Update(double elapsedTime) { Point mousePos = _input.Mouse.Position; FindNearestPolygon(mousePos); FindSelectedVertex(mousePos); if (_input.Keyboard.IsKeyPressed(System.Windows.Forms.Keys.A)) { _convexPolyForm.Add(new ConvexPolyForm(mousePos)); } if (_input.Keyboard.IsKeyPressed(System.Windows.Forms.Keys.I)) { if (_selectedPoly != null) { _selectedPoly.TryAddVert(mousePos); } } if (_input.Keyboard.IsKeyPressed(System.Windows.Forms.Keys.C)) { _editState = EditState.ConnectPressed; _connectStart = mousePos; } if (_input.Keyboard.IsKeyPressed(System.Windows.Forms.Keys.F)) { _pathFinder.Init(_convexPolyForm, _connections); _stateSystem.ChangeState("pathfinder"); } if (_input.Mouse.LeftPressed && _editState == EditState.ConnectPressed) { CheckForConnection(); _editState = EditState.Default; } if (_editState == EditState.ConnectPressed) { FindIntersectedEdges(_connectStart, mousePos); } if (_input.Mouse.LeftHeld && _selectedVert != -1) { _editState = EditState.VertexPressed; _selectedPoly.TryUpdateVertPosition(_selectedVert, mousePos); } else { if (_editState == EditState.VertexPressed) { _editState = EditState.Default; } } }
private void button1_Click(object sender, EventArgs e) { ClearPanel1(); editState = EditState.Creating; panel1.Enabled = true; }
public override void EnterState(EditState editState) { base.EnterState(editState); UpdateEnablers(); }
private async void DoActionSymbolChanged(object param) { _selectedSymbol = param as SymbolViewModel; //Cancel editing if started if (_mapView.Editor.Cancel.CanExecute(null)) { _mapView.Editor.Cancel.Execute(null); } if (_selectedSymbol != null) { Dictionary<string, string> values = (Dictionary<string, string>)_selectedSymbol.Model.Values; _geometryType = values["GeometryType"]; DrawShape drawShape = DrawShape.Point; switch (_geometryType) { case "Point": drawShape = DrawShape.Point; break; case "Line": drawShape = DrawShape.Polyline; break; case "Polygon": drawShape = DrawShape.Polygon; break; default: drawShape = DrawShape.Point; break; } _editState = EditState.Create; try { // get geometry from editor var geometry = await _mapView.Editor.RequestShapeAsync(drawShape); _editState = EditState.None; // process symbol with geometry ProcessSymbol(_selectedSymbol, geometry); } catch (TaskCanceledException) { // clean up when drawing task is canceled } } }
private void DoActionCancel(object obj) { if (_mapView != null) { if (_mapView.Editor.Cancel.CanExecute(null)) { _mapView.Editor.Cancel.Execute(null); RestoreGeometry(); } } if (_editState == EditState.Create || _editState == EditState.Edit) { _editState = EditState.None; } }
private void ResetTextEditState() { HideEraseButton(); editedTextBox.Parent.Controls.Remove(editedTextBox); editedTextBox = null; editedTextView = null; State = EditState.Ready; }
private void DoDragDropStarted(object obj) { _editState = EditState.DragDrop; }
private void ChangeEditState(EditState NewEditState) { curState = NewEditState; if (curState == EditState.Browse) { ClearControls(); grpNewUser.Visible = true; webcam.Stop(); grpNewUser.Enabled = false; grpUserSearch.Enabled = true; userLookup1.Clear(); userLookup1.Focus(); userLookup1.Focus(); btnSave.Enabled = false; btnNew.Enabled = true; btnCancelClose.Enabled = true; userLookup1.GrabFocus(); } else if (curState == EditState.Create) { ClearControls(); grpNewUser.Visible = true; grpNewUser.Enabled = true; grpUserSearch.Enabled = false; txtUserName.Focus(); btnSave.Enabled = true; btnNew.Enabled = false; btnCancelClose.Enabled = true; } else if (curState == EditState.Edit) { ClearControls(); grpNewUser.Visible = true; btnCapture.Enabled = false; grpNewUser.Enabled = true; grpUserSearch.Enabled = false; txtUserName.Focus(); btnSave.Enabled = true; btnNew.Enabled = false; btnCancelClose.Enabled = true; } }
public void MouseUp(Point e, Input.MouseButton b) { switch (state) { case EditState.Copying: { var x1 = (int)p1.X; var y1 = (int)p1.Y; var x2 = (int)p2.X; var y2 = (int)p2.Y; var i = x1; if (x1 > x2) { i = x1; x1 = x2; x2 = i; } if (y1 > y2) { i = y1; y1 = y2; y2 = i; } curselection = Copy(x1, y1, x2, y2); state = EditState.DoingNothing; break; } case EditState.Pasting: { int x = e.X; int y = e.Y; ScreenToTile(ref x, ref y); Paste(x, y, curselection); state = EditState.DoingNothing; break; } } }
private bool CanEnterState(object parameter, EditState editState) { return EditStatesEnabled.Contains(editState); }
public EditStateCommand(Action<object, EditState> execute, EditState editState, Func<object, EditState, bool> canEnterState) : this(execute, editState, canEnterState, null) { }