private void 新建文件夹ToolStripMenuItem_Click(object sender, EventArgs e) { if (txtRemotedirectory.Text.IsNullOrEmpty()) { MessageBoxHelper.ShowBoxExclamation("根目录不能创建文件夹!"); return; } EnterForm dlg = new EnterForm(); dlg.Caption = "请输入文件夹名称!"; if (dlg.ShowDialog() == DialogResult.OK && !dlg.Value.IsNullOrEmpty()) { foreach (FileListViewItem item in fileList.Items) { if (item.FileName.ToLower() == dlg.Value.ToLower()) { MessageBoxHelper.ShowBoxExclamation("已与现有文件重名!"); return; } } if (FileHelper.HasIllegalCharacters(dlg.Value)) { var targetPath = Path.Combine(txtRemotedirectory.Text, dlg.Value); if (!this.RemoteCreateDirectory(targetPath)) { MessageBoxHelper.ShowBoxExclamation("文件夹创建失败,目标路径过长!"); } } else { MessageBoxHelper.ShowBoxError("文件名不能包含 | / \\ * ? \" < > : 等特殊符号!"); } } }
private void 重命名ToolStripMenuItem_Click(object sender, EventArgs e) { var files = this.GetSelectFiles(); if (files.Any()) { var file = files.FirstOrDefault(); if (file.FileType == FileItemType.Disk) { MessageBoxHelper.ShowBoxError("磁盘不能作为重命名的对象!"); return; } EnterForm dlg = new EnterForm(); dlg.Caption = "请为 " + file.FileName + " 命名新的名称!"; dlg.Value = file.FileName; if (dlg.Value != "" && dlg.ShowDialog() == DialogResult.OK) { if (FileHelper.HasIllegalCharacters(dlg.Value)) { this.RemoteFileAdapterHandler.RemoteFileRename(Path.Combine(txtRemotedirectory.Text, file.FileName), Path.Combine(txtRemotedirectory.Text, dlg.Value)); } else { MessageBoxHelper.ShowBoxError("文件名不能包含 | / \\ * ? \" < > : 等特殊符号!"); } } } }
private void CloseChatForm(object sender, EventArgs eventArgs) { EnterForm.FormClosed -= CloseEnterForm; ErrorForm.Close(); EnterForm.Close(); Application.ExitThread(); }
private void ChatService_OnConnectionClosed() { MessageBox.Show("Соединение с сервером потеряно!", "Внимание", MessageBoxButton.OK, MessageBoxImage.Warning); this.Dispatcher.Invoke(() => { var enterForm = new EnterForm(); enterForm.Show(); this.Close(); }); }
public MessengerAppContext(EnterForm enterForm, ChatForm chatForm, ErrorForm errorForm) { EnterForm = enterForm; ChatForm = chatForm; ErrorForm = errorForm; EnterForm.FormClosed += CloseEnterForm; ChatForm.FormClosed += CloseChatForm; EnterForm.Show(); ChatForm.Hide(); ErrorForm.Hide(); }
private void btnKapat_Click(object sender, EventArgs e) { this.Close(); Form f = Application.OpenForms["EnterForm"]; if (f == null) { var form = new EnterForm(); form.Show(); } else { f.Activate(); } }
private void 新建ToolStripMenuItem_Click(object sender, EventArgs e) { var node = list.SelectedNode; if (node == null) { return; } path.Text = node.FullPath; EnterForm dlg = new EnterForm(); dlg.Caption = "正在往 " + path.Text + " 中创建子项! 请输入项名称"; if (dlg.ShowDialog() == DialogResult.OK || dlg.Value != "") { if (dlg.Value == "") { MessageBox.Show("子项名称不能为空!", "提示", 0, MessageBoxIcon.Exclamation); return; } foreach (TreeNode item in node.Nodes) { if (item.Text == dlg.Value) { MessageBox.Show(dlg.Value + "已存在,创建失败!", "提示", 0, MessageBoxIcon.Exclamation); return; } } _adapter.SendAsyncMessage(MessageHead.S_REG_CREATESUBKEY, new RegNewSubkeyPack() { Root = directoryNames.Text, NodePath = path.Text, NewSubKeyName = dlg.Value }); list.Enabled = false; } }
public SessionContext GetIdentifierContext(EntranceContext context) { if (null == context) { throw new ArgumentNullException(nameof(context)); } var form = new EnterForm(context); var template = TemplateLoader.LoadTemplate <TunableListTemplate>(context.ExtensionManager, ExtensionCatalog.Enter); form.ApplyTemplate(template); form.DisplayItems(); if (DialogResult.OK != form.ShowDialog()) { return(null); } return(new SessionContext(context, form.Session)); }
protected override void WndProc(ref Message m) { if (m.Msg == WM_SYSCOMMAND) { IntPtr sysMenuHandle = GetSystemMenu(m.HWnd, false); switch (m.WParam.ToInt32()) { case IDM_SCREENMON: if (_screenDisplayMode == ScreenDisplayMode.Original) { return; } CheckMenuItem(sysMenuHandle, IDM_SCREENMON, MF_CHECKED); CheckMenuItem(sysMenuHandle, IDM_FULL_SCREEN, MF_UNCHECKED); EnableMenuItem(sysMenuHandle, IDM_KEYMOUSE_CTRL, MF_ENABLED); this.imgDesktop.Dock = DockStyle.None; this.imgDesktop.SizeMode = PictureBoxSizeMode.AutoSize; _screenDisplayMode = ScreenDisplayMode.Original; break; case IDM_FULL_SCREEN: if (_screenDisplayMode == ScreenDisplayMode.Fullscreen) { return; } CheckMenuItem(sysMenuHandle, IDM_FULL_SCREEN, MF_CHECKED); CheckMenuItem(sysMenuHandle, IDM_SCREENMON, MF_UNCHECKED); //CheckMenuItem(sysMenuHandle, IDM_KEYMOUSE_CTRL, MF_UNCHECKED); //EnableMenuItem(sysMenuHandle, IDM_KEYMOUSE_CTRL, MF_DISABLED); this.imgDesktop.Dock = DockStyle.Fill; this.imgDesktop.SizeMode = PictureBoxSizeMode.StretchImage; _screenDisplayMode = ScreenDisplayMode.Fullscreen; break; case IDM_KEYMOUSE_CTRL: if (_isControl == true) { CheckMenuItem(sysMenuHandle, IDM_KEYMOUSE_CTRL, MF_UNCHECKED); _isControl = false; } else { CheckMenuItem(sysMenuHandle, IDM_KEYMOUSE_CTRL, MF_CHECKED); _isControl = true; } break; case IDM_LOCK_MOUSEKEY: if (_islockMkey == false) { this.RemoteScreenAdapterHandler.RemoteMouseBlock(true); _islockMkey = true; CheckMenuItem(sysMenuHandle, IDM_LOCK_MOUSEKEY, MF_CHECKED); } else { this.RemoteScreenAdapterHandler.RemoteMouseBlock(false); _islockMkey = false; CheckMenuItem(sysMenuHandle, IDM_LOCK_MOUSEKEY, MF_UNCHECKED); } break; case IDM_BLACKSCREEN: this.RemoteScreenAdapterHandler.RemoteScreenBlack(); break; case IDM_SAVESCREEN: string fileName = DateTime.Now.ToFileTime().ToString() + " 远程桌面快照.bmp"; Image img = imgDesktop.Image; img.Save(fileName); MessageBoxHelper.ShowBoxExclamation("快照已保存到:" + Path.Combine(Environment.CurrentDirectory, fileName)); break; case IDM_FULL_DIFFER: CheckMenuItem(sysMenuHandle, IDM_FULL_DIFFER, MF_CHECKED); CheckMenuItem(sysMenuHandle, IDM_DIFFER, MF_UNCHECKED); this.RemoteScreenAdapterHandler.RemoteChangeScanMode(ScreenScanMode.Noninterlaced); break; case IDM_DIFFER: CheckMenuItem(sysMenuHandle, IDM_FULL_DIFFER, MF_UNCHECKED); CheckMenuItem(sysMenuHandle, IDM_DIFFER, MF_CHECKED); this.RemoteScreenAdapterHandler.RemoteChangeScanMode(ScreenScanMode.Difference); break; case IDM_1X: CheckMenuItem(sysMenuHandle, IDM_1X, MF_CHECKED); CheckMenuItem(sysMenuHandle, IDM_4X, MF_UNCHECKED); CheckMenuItem(sysMenuHandle, IDM_16X, MF_UNCHECKED); this.RemoteScreenAdapterHandler.RemoteResetBrandColor(BrandColorMode.X1); break; case IDM_4X: CheckMenuItem(sysMenuHandle, IDM_1X, MF_UNCHECKED); CheckMenuItem(sysMenuHandle, IDM_4X, MF_CHECKED); CheckMenuItem(sysMenuHandle, IDM_16X, MF_UNCHECKED); this.RemoteScreenAdapterHandler.RemoteResetBrandColor(BrandColorMode.X4); break; case IDM_16X: CheckMenuItem(sysMenuHandle, IDM_1X, MF_UNCHECKED); CheckMenuItem(sysMenuHandle, IDM_4X, MF_UNCHECKED); CheckMenuItem(sysMenuHandle, IDM_16X, MF_CHECKED); this.RemoteScreenAdapterHandler.RemoteResetBrandColor(BrandColorMode.X16); break; case IDM_Qty: var dlg = new ScreenQtyForm(); if (dlg.ShowDialog() == DialogResult.OK) { this.RemoteScreenAdapterHandler.RemoteSetScreenQuantity(dlg.QualityValue); } break; case IDM_SET_CLIPBOARD: using (var setClipoardDlg = new EnterForm()) { setClipoardDlg.Caption = "设置的剪切板内容:"; if (setClipoardDlg.ShowDialog() == DialogResult.OK) { var text = setClipoardDlg.Value; this.RemoteScreenAdapterHandler.SetRemoteClipoardText(text); } } break; case IDM_GET_CLIPBOARD: this.RemoteScreenAdapterHandler.GetRemoteClipoardText(); break; case IDM_CTRL_ALT_DEL: this.RemoteScreenAdapterHandler.SendCtrlAltDel(); break; case IDM_CHANGE_MONITOR: var dialog = new ScreenMonitorChangeForm(); dialog.SetMonitors(_monitorItems, _currenMonitorIndex); if (dialog.ShowDialog() == DialogResult.OK) { if (_currenMonitorIndex == dialog.CurrentMonitorIndex) { break; } _currenMonitorIndex = dialog.CurrentMonitorIndex; this.RemoteScreenAdapterHandler.MonitorChange(dialog.CurrentMonitorIndex); } break; case IDM_DELETE_WALLPAPER: this.RemoteScreenAdapterHandler.RemoteDeleteWallPaper(); break; case IDM_RECORD: if (_stop) { if (_srcImageHeight == 0 || _srcImageWidth == 0) { return; } if (!_videoFrameGraphics.IsNull()) { _videoFrameGraphics.Dispose(); } if (!_videoFrame.IsNull()) { _videoFrame.Dispose(); } lock (this) { _videoFrame = new Bitmap(this._srcImageWidth, this._srcImageHeight); _videoFrameGraphics = Graphics.FromImage(_videoFrame); _videoFrameGraphics.DrawImage(_currentFrame, 0, 0); } _stop = false; ModifyMenu(sysMenuHandle, _menuContextIndex, MF_BYPOSITION, IDM_RECORD, "停止录制"); Task.Run(CreateDesktopRecordThread); } else { _stop = true; ModifyMenu(sysMenuHandle, _menuContextIndex, MF_BYPOSITION, IDM_RECORD, "开始录制"); } break; } } base.WndProc(ref m); }