コード例 #1
0
ファイル: MainPresenter.cs プロジェクト: pre078/ApsimX
        /// <summary>Populate the view for the first time. Will throw if there are errors on startup.</summary>
        /// <param name="startPage">The start page to populate.</param>
        private void PopulateStartPage(IListButtonView startPage)
        {
            // Add the buttons into the main window.
            startPage.AddButton("Open APSIM File",
                                new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("UserInterface.Resources.Toolboxes.OpenFile.png")),
                                OnOpenApsimXFile);

            startPage.AddButton("Open an example",
                                new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("UserInterface.Resources.Toolboxes.OpenExample.png")),
                                OnExample);

            startPage.AddButton("Open standard toolbox",
                                new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("UserInterface.Resources.Toolboxes.Toolbox.png")),
                                OnStandardToolboxClick);

            startPage.AddButton("Open management toolbox",
                                new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("UserInterface.Resources.Toolboxes.Toolbox.png")),
                                OnManagementToolboxClick);

            startPage.AddButton("Open training toolbox",
                                new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("UserInterface.Resources.Toolboxes.Toolbox.png")),
                                OnTrainingToolboxClick);

            startPage.AddButton("Import old .apsim file",
                                new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("UserInterface.Resources.Toolboxes.Import.png")),
                                OnImport);

            startPage.AddButton("Upgrade",
                                new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("UserInterface.Resources.MenuImages.Upgrade.png")),
                                OnUpgrade);

            // Populate the view's listview.
            startPage.List.Values = Utility.Configuration.Settings.MruList.ToArray();
        }
コード例 #2
0
ファイル: MainPresenter.cs プロジェクト: oseledets/ApsimX
        /// <summary>Populate the view for the first time. Will throw if there are errors on startup.</summary>
        /// <param name="startPage">The start page to populate.</param>
        private void PopulateStartPage(IListButtonView startPage)
        {
            // Add the buttons into the main window.
            startPage.AddButton("Open APSIM File",
                                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.OpenFile.png"),
                                OnOpenApsimXFile);

            startPage.AddButton("Open an example",
                                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.OpenExample.png"),
                                OnExample);

            startPage.AddButton("Standard toolbox",
                                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                                OnStandardToolboxClick);

            startPage.AddButton("Management toolbox",
                                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                                OnManagementToolboxClick);

            startPage.AddButton("Training toolbox",
                                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                                OnTrainingToolboxClick);

            startPage.AddButton("Import old .apsim file",
                                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Import.png"),
                                OnImport);

            startPage.AddButton("Upgrade",
                                new Gtk.Image(null, "ApsimNG.Resources.MenuImages.Upgrade.png"),
                                OnUpgrade);

            // Populate the view's listview.
            startPage.List.Values = Utility.Configuration.Settings.MruList.ToArray();
        }
コード例 #3
0
        /// <summary>
        /// Populate the view for the first time. Will throw if there are errors on startup.
        /// </summary>
        /// <param name="startPage">The start page to populate.</param>
        private void PopulateStartPage(IListButtonView startPage)
        {
            // Add the buttons into the main window.
            startPage.AddButton(
                "Open APSIM File",
                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.OpenFile.png"),
                this.OnOpenApsimXFile);

            startPage.AddButton(
                "Open an example",
                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.OpenExample.png"),
                this.OnExample);

            startPage.AddButton(
                "Standard toolbox",
                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                this.OnStandardToolboxClick);

            startPage.AddButton(
                "Management toolbox",
                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                this.OnManagementToolboxClick);

            startPage.AddButton(
                "Training toolbox",
                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                this.OnTrainingToolboxClick);

            startPage.AddButton(
                "Import old .apsim file",
                new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Import.png"),
                this.OnImport);

            startPage.AddButton(
                "Upgrade",
                new Gtk.Image(null, "ApsimNG.Resources.MenuImages.Upgrade.png"),
                this.OnUpgrade);

            startPage.AddButton(
                "View Cloud Jobs",
                new Gtk.Image(null, "ApsimNG.Resources.Cloud.png"),
                this.OnViewCloudJobs);

            startPage.AddButton(
                "Help",
                new Gtk.Image(null, "ApsimNG.Resources.MenuImages.Help.png"),
                this.OnHelp);
#if DEBUG
            startPage.AddButton(
                "Convert XML File",
                new Gtk.Image(null, "ApsimNG.Resources.MenuImages.Upgrade.png"),
                this.OnShowConverter);
#endif

            // Populate the view's listview.
            startPage.List.Values = Utility.Configuration.Settings.MruList.ToArray();

            this.PopulatePopup(startPage);
        }
コード例 #4
0
ファイル: AddFunctionPresenter.cs プロジェクト: hol353/ApsimX
        /// <summary>Attach the specified Model and View.</summary>
        /// <param name="model">The axis model</param>
        /// <param name="view">The axis view</param>
        /// <param name="explorerPresenter">The parent explorer presenter</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.model = model as IModel;
            this.view = view as IListButtonView;
            this.explorerPresenter = explorerPresenter;

            allowableChildFunctions = Apsim.GetAllowableChildFunctions(this.model);

            this.view.List.Values = allowableChildFunctions.Select(m => m.Name).ToArray();
            this.view.AddButton("Add", null, this.OnAddButtonClicked);

            // Trap events from the view.
            this.view.List.DoubleClicked += this.OnAddButtonClicked;
        }
コード例 #5
0
        /// <summary>Attach the specified Model and View.</summary>
        /// <param name="model">The axis model</param>
        /// <param name="view">The axis view</param>
        /// <param name="explorerPresenter">The parent explorer presenter</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.model             = model as IModel;
            this.view              = view as IListButtonView;
            this.explorerPresenter = explorerPresenter;

            allowableChildModels = Apsim.GetAllowableChildModels(this.model);

            this.view.List.Values = allowableChildModels.Select(m => m.Name).ToArray();
            this.view.AddButton("Add", null, this.OnAddButtonClicked);

            // Trap events from the view.
            this.view.List.DoubleClicked += this.OnAddButtonClicked;
        }
コード例 #6
0
        /// <summary>Attach the specified Model and View.</summary>
        /// <param name="model">The axis model</param>
        /// <param name="view">The axis view</param>
        /// <param name="explorerPresenter">The parent explorer presenter</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.model             = model as IModel;
            this.view              = view as IListButtonView;
            this.explorerPresenter = explorerPresenter;

            storage = Apsim.Find(this.model, typeof(DataStore)) as DataStore;

            this.view.List.IsModelList = false;
            this.view.List.Values      = storage.Reader.CheckpointNames.ToArray();
            this.view.AddButton("Add", null, this.OnAddButtonClicked);
            this.view.AddButton("Delete", null, this.OnDeleteButtonClicked);
            this.view.AddButton("RevertTo", null, this.OnRevertToButtonClicked);
            PopulateList();
        }
コード例 #7
0
        /// <summary>Attach the specified Model and View.</summary>
        /// <param name="model">The axis model</param>
        /// <param name="view">The axis view</param>
        /// <param name="explorerPresenter">The parent explorer presenter</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.model             = model as IModel;
            this.view              = view as IListButtonView;
            this.explorerPresenter = explorerPresenter;

            this.allowableChildFunctions = Apsim.GetAllowableChildFunctions(this.model);

            this.view.List.IsModelList = true;
            this.view.List.Values      = this.allowableChildFunctions.Select(m => m.FullName).ToArray();
            this.view.AddButton("Add", null, this.OnAddButtonClicked);

            // Trap events from the view.
            this.view.List.DoubleClicked += this.OnAddButtonClicked;
            this.view.List.DragStarted   += this.OnDragStart;
        }
コード例 #8
0
        /// <summary>
        /// Defines the list of items to be included in a popup menu for the
        /// most-recently-used file display
        /// </summary>
        /// <param name="startPage">The page to which the menu will be added</param>
        private void PopulatePopup(IListButtonView startPage)
        {
            List <MenuDescriptionArgs> descriptions = new List <MenuDescriptionArgs>();
            MenuDescriptionArgs        descOpen     = new MenuDescriptionArgs();

            descOpen.Name    = "Open";
            descOpen.Enabled = true;
            descOpen.OnClick = this.OnOpen;
            descriptions.Add(descOpen);

            MenuDescriptionArgs descRemove = new MenuDescriptionArgs();

            descRemove.Name    = "Remove from recent file list";
            descRemove.Enabled = true;
            descRemove.OnClick = this.OnRemove;
            descriptions.Add(descRemove);

            MenuDescriptionArgs descClear = new MenuDescriptionArgs();

            descClear.Name    = "Clear recent file list";
            descClear.Enabled = true;
            descClear.OnClick = this.OnClear;
            descriptions.Add(descClear);

            MenuDescriptionArgs descRename = new MenuDescriptionArgs();

            descRename.Name    = "Rename";
            descRename.Enabled = true;
            descRename.OnClick = this.OnRename;
            descriptions.Add(descRename);

            MenuDescriptionArgs descCopy = new MenuDescriptionArgs();

            descCopy.Name    = "Copy";
            descCopy.Enabled = true;
            descCopy.OnClick = this.OnCopy;
            descriptions.Add(descCopy);

            MenuDescriptionArgs descDelete = new MenuDescriptionArgs();

            descDelete.Name    = "Delete";
            descDelete.Enabled = true;
            descDelete.OnClick = this.OnDelete;
            descriptions.Add(descDelete);

            startPage.List.PopulateContextMenu(descriptions);
        }
コード例 #9
0
ファイル: MainPresenter.cs プロジェクト: byzheng/ApsimX
        /// <summary>Populate the view for the first time. Will throw fif there are errors on startup.</summary>
        /// <param name="startPage">The start page to populate.</param>
        private void PopulateStartPage(IListButtonView startPage)
        {
            // Add the buttons into the main window.
            startPage.AddButton("Open APSIM File",
                                          new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.OpenFile.png"),
                                          OnOpenApsimXFile);

            startPage.AddButton("Open an example",
                                          new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.OpenExample.png"),
                                          OnExample);

            startPage.AddButton("Open standard toolbox",
                                          new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                                          OnStandardToolboxClick);

            startPage.AddButton("Open management toolbox",
                                          new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                                          OnManagementToolboxClick);

            startPage.AddButton("Open training toolbox",
                                          new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Toolbox.png"),
                                          OnTrainingToolboxClick);

            startPage.AddButton("Import old .apsim file",
                                          new Gtk.Image(null, "ApsimNG.Resources.Toolboxes.Import.png"),
                                          OnImport);

            startPage.AddButton("Upgrade",
                              new Gtk.Image(null, "ApsimNG.Resources.MenuImages.Upgrade.png"),
                              OnUpgrade);

            // Populate the view's listview.
            startPage.List.Values = Utility.Configuration.Settings.MruList.ToArray();
        }