/// <summary> /// Handles Control Click Events. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void BtnClick(object sender, EventArgs e) { ICommand currentCommand = null; if (sender.Equals(btnCancel)) { this.Close(); } else if (sender.Equals(btnUndo)) { commandsList.Undo(); } else if (sender.Equals(btnRedo)) { commandsList.Redo(); } else if (sender.Equals(btnSave)) { SaveEnvironmentVariable(); } else if (sender.Equals(btnExport)) { ExportEnvironmentVariable(); } else if (sender.Equals(btnImport)) { ImportEnvironmentVariable(); } //PRANK!E code changes start here --> if (sender.Equals(tsmiLocateInWindowsExplorer)) { LocateInWindowsExplorer(); } //PRANK!E code changes end here --> else { if (sender.Equals(btnDelete)) { dgvValuesList_UserDeletingRow(null, null); } else if (sender.Equals(btnBrowse)) { BrowseFolder(); } #region Move Row else if (sender.Equals(btnMoveUp)) { currentCommand = new DgvMoveUpCommand(dgvHandler); } else if (sender.Equals(btnMoveTop)) { currentCommand = new DgvMoveToTopCommand(dgvHandler); } else if (sender.Equals(btnMoveDown)) { currentCommand = new DgvMoveDownCommand(dgvHandler); } else if (sender.Equals(btnMoveBottom)) { currentCommand = new DgvMoveToBottomCommand(dgvHandler); } #endregion Move Row } if (!sender.Equals(btnCancel)) { AddCommand(currentCommand); } }
/// <summary> /// Handles Control Click Events. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void BtnClick(object sender, EventArgs e) { ICommand currentCommand = null; if (sender.Equals(btnCancel)) { this.Close(); } else if (sender.Equals(btnUndo)) { commandsList.Undo(); } else if (sender.Equals(btnRedo)) { commandsList.Redo(); } else if (sender.Equals(btnSave)) { SaveEnvironmentVariable(); } else if (sender.Equals(btnExport)) { ExportEnvironmentVariable(); } else if (sender.Equals(btnImport)) { ImportEnvironmentVariable(); } else if (sender.Equals(tsmiLocate)) { LocateInWindowsExplorer(); } else if (sender.Equals(tsmiCut)) { var index = dgvValuesList.SelectedRows[0].Index; if (index != -1) { if (dgvValuesList[1, index].Value != null) { Clipboard.SetText(dgvValuesList[1, index].Value.ToString()); dgvValuesList.Rows.RemoveAt(index); } } } else if (sender.Equals(tsmiCopy)) { var index = dgvValuesList.SelectedRows[0].Index; if (index != -1) { if (dgvValuesList[1, index].Value != null) { Clipboard.SetText(dgvValuesList[1, index].Value.ToString()); } } } else if (sender.Equals(tsmiPaste)) { var index = dgvValuesList.SelectedRows[0].Index; if (index != -1) { string dgvValue = Clipboard.GetText(); string cmdValue = dgvValuesList[1, index].Value as string; if (cmdValue == null) { dgvValuesList[0, dgvValuesList.Rows.Add()].Value = Properties.Resources.ValTypeNull; } if (dgvValue != null && (cmdValue == null || cmdValue != dgvValue)) { dgvValuesList[1, index].Value = dgvValue; dgvHandler.SetRowIcon(index, dgvValue as string); dgvHandler.SetCellToolTip(index, dgvValue as string); } else { if (cmdValue != null) { dgvValuesList[1, index].Value = cmdValue; } SetBtnState(); } } } else if (sender.Equals(btnDelete)) { dgvValuesList_UserDeletingRow(null, null); } else if (sender.Equals(btnDelDupes)) { dgvValuesList_UserDeletingDupedRows(); } else if (sender.Equals(btnSortValues)) { dgvValuesList_UserSortRows(); } else if (sender.Equals(btnBrowse)) { BrowseFolder(); } #region Move Row else if (sender.Equals(btnMoveUp)) { currentCommand = new DgvMoveUpCommand(dgvHandler); } else if (sender.Equals(btnMoveTop)) { currentCommand = new DgvMoveToTopCommand(dgvHandler); } else if (sender.Equals(btnMoveDown)) { currentCommand = new DgvMoveDownCommand(dgvHandler); } else if (sender.Equals(btnMoveBottom)) { currentCommand = new DgvMoveToBottomCommand(dgvHandler); } #endregion Move Row if (!sender.Equals(btnCancel)) { AddCommand(currentCommand); } }
/// <summary> /// Handles Control Click Events. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void BtnClick(object sender, EventArgs e) { ICommand currentCommand = null; if (sender.Equals(this.btnCancel)) { this.Close(); } else if (sender.Equals(this.btnUndo)) { this.commandsList.Undo(); } else if (sender.Equals(this.btnRedo)) { this.commandsList.Redo(); } else if (sender.Equals(this.btnSave)) { this.SaveEnvironmentVariable(); } else if (sender.Equals(this.btnExport)) { this.ExportEnvironmentVariable(); } else if (sender.Equals(this.btnImport)) { this.ImportEnvironmentVariable(); } if (sender.Equals(this.tsmiLocateInWindowsExplorer)) { ////PRANK!E code changes start here --> this.LocateInWindowsExplorer(); ////PRANK!E code changes end here --> } else { if (sender.Equals(this.btnDelete)) { this.DgvValuesList_UserDeletingRow(null, null); } else if (sender.Equals(this.btnBrowse)) { this.BrowseFolder(); } else if (sender.Equals(this.btnMoveUp)) { currentCommand = new DgvMoveUpCommand(this.dgvHandler); } else if (sender.Equals(this.btnMoveTop)) { currentCommand = new DgvMoveToTopCommand(this.dgvHandler); } else if (sender.Equals(this.btnMoveDown)) { currentCommand = new DgvMoveDownCommand(this.dgvHandler); } else if (sender.Equals(this.btnMoveBottom)) { currentCommand = new DgvMoveToBottomCommand(this.dgvHandler); } } if (!sender.Equals(this.btnCancel)) { this.AddCommand(currentCommand); } }