private void butDrag_MouseDown(object sender, MouseEventArgs e) { if (DockedControl == null) { return; } DockedControl.DoDragDrop(_dockedControlHolder, DragDropEffects.All); }
internal void OpenCommandLineArgs(string[] commandLineArgs, bool isReadOnly = false) { PgnEditor lastOpenedPgnEditor = null; // Interpret each command line argument as a file to open. commandLineArgs.ForEach(pgnFileName => { // Catch exception for each open action individually. try { lastOpenedPgnEditor = NewOrExistingPgnEditor(pgnFileName, isReadOnly); } catch (Exception exception) { // For now, show the exception to the user. // Maybe user has no access to the path, or the given file name is not a valid. // TODO: analyze what error conditions can occur and handle them appropriately. MessageBox.Show( $"Attempt to open code file '{pgnFileName}' failed with message: '{exception.Message}'", pgnFileName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }); if (lastOpenedPgnEditor != null) { // Only activate the last opened PGN editor. lastOpenedPgnEditor.EnsureActivated(); } else if (DockedControl.TabPages.Count == 0) { // Open default new untitled file. OpenNewPgnEditor(); } else { // If no arguments were given, just activate the form. DockedControl.EnsureActivated(); } }