Changeset 11467
- Timestamp:
- 10/15/14 19:40:51 (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
r11171 r11467 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; 59 62 // 60 63 // toolStrip … … 64 67 this.toolStrip.Size = new System.Drawing.Size(624, 25); 65 68 this.toolStrip.TabIndex = 1; 69 this.toolStrip.AllowDrop = true; 70 this.toolStrip.DragEnter += MainFormBase_DragEnter; 71 this.toolStrip.DragDrop += MainFormBase_DragDrop; 66 72 // 67 73 // statusStrip … … 73 79 this.statusStrip.Text = "statusStrip"; 74 80 // 75 // MainForm Base81 // MainForm 76 82 // 77 83 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
r11171 r11467 555 555 try { 556 556 ((IActionUserInterfaceItem)item.Tag).Execute(); 557 } catch (Exception ex) { 557 } 558 catch (Exception ex) { 558 559 ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, ex); 559 560 } … … 600 601 } 601 602 #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 type 606 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 } 602 633 } 603 634 }
Note: See TracChangeset
for help on using the changeset viewer.