Changeset 11469 for trunk/sources
- Timestamp:
- 10/16/14 12:14:25 (10 years ago)
- Location:
- trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.Designer.cs
r11467 r11469 57 57 this.menuStrip.TabIndex = 0; 58 58 this.menuStrip.Text = "menuStrip"; 59 this.menuStrip.AllowDrop = true;60 this.menuStrip.DragEnter += MainFormBase_DragEnter;61 this.menuStrip.DragDrop += MainFormBase_DragDrop;62 59 // 63 60 // toolStrip … … 67 64 this.toolStrip.Size = new System.Drawing.Size(624, 25); 68 65 this.toolStrip.TabIndex = 1; 69 this.toolStrip.AllowDrop = true;70 this.toolStrip.DragEnter += MainFormBase_DragEnter;71 this.toolStrip.DragDrop += MainFormBase_DragDrop;72 66 // 73 67 // statusStrip … … 79 73 this.statusStrip.Text = "statusStrip"; 80 74 // 81 // MainForm 75 // MainFormBase 82 76 // 83 77 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); … … 93 87 this.ResumeLayout(false); 94 88 this.PerformLayout(); 95 96 89 } 97 90 -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
r11467 r11469 555 555 try { 556 556 ((IActionUserInterfaceItem)item.Tag).Execute(); 557 } 558 catch (Exception ex) { 557 } catch (Exception ex) { 559 558 ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, ex); 560 559 } … … 601 600 } 602 601 #endregion 603 604 private void MainFormBase_DragEnter(object sender, DragEventArgs e) {605 // perform type checking to ensure that the data being dragged is of an acceptable type606 e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;607 }608 609 private void MainFormBase_DragDrop(object sender, DragEventArgs e) {610 if (e.Data.GetDataPresent(DataFormats.FileDrop)) {611 string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);612 foreach (var path in files) {613 SetAppStartingCursor();614 ContentManager.LoadAsync(path, LoadingCompleted);615 }616 }617 }618 619 private static void LoadingCompleted(IStorableContent content, Exception error) {620 try {621 if (error != null) throw error;622 IView view = MainFormManager.MainForm.ShowContent(content);623 if (view == null)624 ErrorHandling.ShowErrorDialog("There is no view for the loaded item. It cannot be displayed.", new InvalidOperationException("No View Available"));625 }626 catch (Exception ex) {627 ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, "Cannot open file.", ex);628 }629 finally {630 ((MainForm)MainFormManager.MainForm).ResetAppStartingCursor();631 }632 }633 602 } 634 603 }
Note: See TracChangeset
for help on using the changeset viewer.