//新增模式 public PoseCombinationSelect(PresentationModel model, Window window) { _presentationModel = model; _window = window; _isEdit = false; InitializeComponent(); }
public WindowAdd(PresentationModel presentationModel, Window window) { InitializeComponent(); _presentationModel = presentationModel; _window = window; _nameTextBox.Text = _window.Name; _imageTextBox.Text = _window.GetImagePath(); _isEdit = true; }
public WindowDetail(PresentationModel model, Window window) { InitializeComponent(); _presentationModel = model; _window = window; _modePictureBox.Invalidate(); BindingSource source = new BindingSource(window.GetPoseCollection(), null); _poseCombinationGridView.DataSource = source; Text = window.Name; InitializeGridView(); }
public void ProcessClickSaveButton(Window window, bool isEdit, string windowName, string windowImage) { if (isEdit) window.Name = windowName; else window = AddWindow(windowName); if (windowImage == "") window.SetImage("Image/Myo.png"); else window.SetImage(windowImage); }
//編輯模式 public PoseCombinationSelect(PresentationModel model, Window window, int editIndex) { _presentationModel = model; _window = window; _isEdit = true; _editIndex = editIndex; InitializeComponent(); InitailizePoseCombination(window.GetPoseCombination(editIndex)); CheckIsContinue(); _posePictureBox.Invalidate(); _keyPictureBox.Invalidate(); }
public void AddPoseCombination(Window window, PoseCombination poseCombination, bool isEdit, int editIndex, Form form) { if (isEdit && !window.IsExistPoseCombinationEdit(poseCombination, editIndex)) { window.RemovePoseCombinationByIndex(editIndex); window.InsertPoseCombination(editIndex, poseCombination); form.Close(); } else if (!isEdit && !window.IsExistPoseCombination(poseCombination)) { window.AddPoseCombination(poseCombination); form.Close(); } else MessageBox.Show("此手勢組合已選擇過!!!", "警告", MessageBoxButtons.OK); }
public void ProcessPoseCombinationGridViewCell(Window window, int rowIndex, int columnIndex) { if (rowIndex >= 0) { PoseCombinationSelect poseCombinationForm = new PoseCombinationSelect(this, window, rowIndex); switch (columnIndex) { // this is delete button, we add delete columns first, then format binding columns // so delete button columns index while be 0, even we setting displayIndex is 1 case 0: window.RemovePoseCombinationByIndex(rowIndex); break; case 4: window.GetPoseCombination(rowIndex).IsEnable = !window.GetPoseCombination(rowIndex).IsEnable; break; default: poseCombinationForm.ShowDialog(); break; } } }
/** * 加入操縱軟體 */ public void AddWindow(Window window) { _windowList.Add(window); }
/** * 取得篩選過後的手勢組合,如果清單中為空的,則取得該視窗下的所有手勢組合 */ private List<PoseCombination> GetFilterPoseCollection(Window window) { List<PoseCombination> poseCollection; if (_filter.Count > 0) { poseCollection = _filter; } else { try { poseCollection = window.GetPoseCollectionList(); } catch (Exception) { poseCollection = new List<PoseCombination>(); //throw new Exception("this window is not defined on list"); } } return poseCollection; }
public void SetFocusWindow(string name) { _focusWindow = _windowList.FirstOrDefault(item => name.ToLower().IndexOf(item.Name.ToLower()) != -1); if (_focusWindow != null && !_focusWindow.IsEnable) { _focusWindow = null; } }
/** * 刪除操縱軟體 */ public void RemoveWindow(Window window) { _windowList.Remove(window); }
public void OpenDetailForm(Window window) { window.IsOpen = true; }
private void OpenWindowDetailForm(Window window, Form detailForm) { if (!window.IsOpen) { OpenDetailForm(window); detailForm.Show(); } else { Form openedForm = ExistForm(window); openedForm.Activate(); } }
private Form ExistForm(Window window) { FormCollection openForms = Application.OpenForms; foreach (Form form in openForms) { if (form.Text == window.Name) { return form; } } return null; }
private void CloseWindowDetailForm(Window window) { Form openedForm = ExistForm(window); if (openedForm != null) openedForm.Close(); }
public void RemoveWindow(Window window) { _model.RemoveWindow(window); }