Beispiel #1
0
 /// <summary>User has pressed one of our shortcut keys.</summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event arguments</param>
 private void OnShortcutKeyPress(object sender, KeysArgs e)
 {
     if (e.Keys == System.Windows.Forms.Keys.F5)
     {
         ContextMenu contextMenu = new ContextMenu(this);
         contextMenu.RunAPSIM(sender, null);
     }
 }
Beispiel #2
0
 /// <summary>User has pressed one of our shortcut keys.</summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event arguments</param>
 private void OnShortcutKeyPress(object sender, KeysArgs e)
 {
     if (e.Keys == ConsoleKey.F5)
     {
         ContextMenu contextMenu = new ContextMenu(this);
         contextMenu.RunAPSIM(sender, null);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Attach the view to this presenter and begin populating the view.
        /// </summary>
        /// <param name="model">The simulation model</param>
        /// <param name="view">The view used for display</param>
        /// <param name="explorerPresenter">The presenter for this object</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.CommandHistory = new CommandHistory();
            this.ApsimXFile = model as Simulations;
            this.view = view as IExplorerView;
            this.mainMenu = new MainMenu(this);
            this.contextMenu = new ContextMenu(this);

            this.view.ShortcutKeys = new string[] { "F5" };
            this.view.SelectedNodeChanged += this.OnNodeSelected;
            this.view.DragStarted += this.OnDragStart;
            this.view.AllowDrop += this.OnAllowDrop;
            this.view.Droped += this.OnDrop;
            this.view.Renamed += this.OnRename;
            this.view.ShortcutKeyPressed += this.OnShortcutKeyPress;

            this.view.Refresh(GetNodeDescription(this.ApsimXFile));
            this.WriteLoadErrors();
            PopulateMainMenu();
        }
Beispiel #4
0
 /// <summary>Detach the model from the view.</summary>
 public void Detach()
 {
     this.view.SelectedNodeChanged -= this.OnNodeSelected;
     this.view.DragStarted -= this.OnDragStart;
     this.view.AllowDrop -= this.OnAllowDrop;
     this.view.Droped -= this.OnDrop;
     this.view.Renamed -= this.OnRename;
     this.view.ShortcutKeyPressed -= this.OnShortcutKeyPress;
     if (this.view is Views.ExplorerView)
         (this.view as Views.ExplorerView).MainWidget.Destroy();
     HideRightHandPanel();
     this.contextMenu = null;
     this.CommandHistory.Clear();
 }