Esempio n. 1
0
        /// <summary>Attaches this presenter to a view.</summary>
        /// <param name="model"></param>
        /// <param name="viewBase"></param>
        /// <param name="parentPresenter"></param>
        public void Attach(object model, object viewBase, ExplorerPresenter parentPresenter)
        {
            presenter  = parentPresenter;
            view       = (ViewBase)viewBase;
            modelToRun = (IModel)model;

            nameOfJobEdit          = view.GetControl <EditView>("nameOfJobEdit");
            numberCPUCombobox      = view.GetControl <DropDownView>("numberCPUCombobox");
            apsimTypeToRunCombobox = view.GetControl <DropDownView>("apsimTypeToRunCombobox");
            directoryLabel         = view.GetControl <LabelView>("directoryLabel");
            directoryEdit          = view.GetControl <EditView>("directoryEdit");
            browseButton           = view.GetControl <ButtonView>("browseButton");
            versionLabel           = view.GetControl <LabelView>("versionLabel");
            versionCombobox        = view.GetControl <DropDownView>("versionCombobox");
            submitButton           = view.GetControl <ButtonView>("submitButton");
            statusLabel            = view.GetControl <LabelView>("statusLabel");
            lowPriorityCheckBox    = view.GetControl <CheckBoxView>("lowPriorityCheckBox");

            nameOfJobEdit.Text              = modelToRun.Name + DateTime.Now.ToString("yyyy-MM-dd HH.mm");
            numberCPUCombobox.Values        = new string[] { "16", "32", "48", "64", "80", "96", "112", "128", "256" };
            numberCPUCombobox.SelectedValue = ApsimNG.Cloud.Azure.AzureSettings.Default.NumCPUCores;

            apsimTypeToRunCombobox.Values = new string[] { "A released version", "A directory", "A zip file" };
            if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion))
            {
                apsimTypeToRunCombobox.SelectedValue = "A released version";
            }
            else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory))
            {
                apsimTypeToRunCombobox.SelectedValue = "A directory";
            }
            else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile))
            {
                apsimTypeToRunCombobox.SelectedValue = "A zip file";
            }
            else
            {
                apsimTypeToRunCombobox.SelectedValue = "A released version";
            }

            SetupWidgets();

            if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion))
            {
                versionCombobox.SelectedValue = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion;
            }
            else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory))
            {
                directoryEdit.Text = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory;
            }
            else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile))
            {
                directoryEdit.Text = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile;
            }
            lowPriorityCheckBox.Checked = ApsimNG.Cloud.Azure.AzureSettings.Default.LowPriority;

            apsimTypeToRunCombobox.Changed += OnVersionComboboxChanged;
            browseButton.Clicked           += OnBrowseButtonClicked;
            submitButton.Clicked           += OnSubmitJobClicked;
        }
Esempio n. 2
0
    IEnumerator HouseInfo()
    {
        /*foreach (House house in houses)
         * {
         *  houses.Add(JsonUtility.FromJson<HouseResponse>(requestHouses.downloadHandler.text)); //again, dumb but works
         * } */

        drop = gameObject.GetComponent <DropDownView>(); //invoking dropdown population now
        drop.PopulateDropdown();
        yield return(null);
    }
Esempio n. 3
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)
        {
            graphModel             = model as Graph;
            this.explorerPresenter = explorerPresenter;

            dropDown               = (view as ViewBase).GetControl <DropDownView>("combobox1");
            dropDown.Values        = new string[] { "TopLeft", "TopRight", "BottomLeft", "BottomRight" };
            dropDown.SelectedValue = graphModel.AnnotationPosition.ToString();

            // Trap events from the view.
            dropDown.Changed += OnDropDownChanged;
        }
Esempio n. 4
0
        /// <summary>Attach the model and view to this presenter and populate the view.</summary>
        /// <param name="model">The data store model to work with.</param>
        /// <param name="v">Data store view to work with.</param>
        /// <param name="explorerPresenter">Parent explorer presenter.</param>
        public override void Attach(object model, object v, ExplorerPresenter explorerPresenter)
        {
            dataStore = model as IDataStore;
            view      = v as ViewBase;
            this.explorerPresenter = explorerPresenter;

            intellisense = new IntellisensePresenter(this.view as ViewBase);
            intellisense.ItemSelected += OnIntellisenseItemSelected;

            checkpointDropDown  = view.GetControl <DropDownView>("checkpointDropDown");
            tableDropDown       = view.GetControl <DropDownView>("tableDropDown");
            columnFilterEditBox = view.GetControl <EditView>("columnFilterEditBox");
            rowFilterEditBox    = view.GetControl <EditView>("rowFilterEditBox");
            grid = view.GetControl <GridView>("grid");
            maxNumRecordsEditBox = view.GetControl <EditView>("maxNumRecordsEditBox");

            base.Attach(model, grid, explorerPresenter);

            tableDropDown.IsEditable = false;
            grid.ReadOnly            = true;
            grid.NumericFormat       = "N3";
            if (dataStore != null)
            {
                tableDropDown.Values = dataStore.Reader.TableAndViewNames.ToArray();
                if (tablesFilter != null && tablesFilter.Length > 0)
                {
                    tableDropDown.Values = tableDropDown.Values.Intersect(tablesFilter).ToArray();
                }
                checkpointDropDown.Values = dataStore.Reader.CheckpointNames.ToArray();
                if (checkpointDropDown.Values.Length > 0)
                {
                    checkpointDropDown.SelectedValue = checkpointDropDown.Values[0];
                }
                if (Utility.Configuration.Settings.MaximumRowsOnReportGrid > 0)
                {
                    maxNumRecordsEditBox.Text = Utility.Configuration.Settings.MaximumRowsOnReportGrid.ToString();
                }
                tableDropDown.SelectedIndex = -1;
            }

            tableDropDown.Changed     += this.OnTableSelected;
            columnFilterEditBox.Leave += OnColumnFilterChanged;
            columnFilterEditBox.IntellisenseItemsNeeded += OnIntellisenseNeeded;
            rowFilterEditBox.Leave     += OnColumnFilterChanged;
            maxNumRecordsEditBox.Leave += OnMaximumNumberRecordsChanged;
            checkpointDropDown.Changed += OnCheckpointDropDownChanged;
            PopulateGrid();
        }
Esempio n. 5
0
        /// <summary>Attach the model and view to this presenter and populate the view.</summary>
        /// <param name="model">The data store model to work with.</param>
        /// <param name="v">Data store view to work with.</param>
        /// <param name="explorerPresenter">Parent explorer presenter.</param>
        public void Attach(object model, object v, ExplorerPresenter explorerPresenter)
        {
            dataStore = model as IDataStore;
            var view = v as ViewBase;

            this.explorerPresenter = explorerPresenter;

            intellisense = new IntellisensePresenter(view as ViewBase);
            intellisense.ItemSelected += OnIntellisenseItemSelected;

            checkpointDropDown  = view.GetControl <DropDownView>("checkpointDropDown");
            tableDropDown       = view.GetControl <DropDownView>("tableDropDown");
            columnFilterEditBox = view.GetControl <EditView>("columnFilterEditBox");
            rowFilterEditBox    = view.GetControl <EditView>("rowFilterEditBox");
            sheetContainer      = view.GetControl <ContainerView>("grid");
            statusLabel         = view.GetControl <LabelView>("statusLabel");

            tableDropDown.IsEditable = false;
            if (dataStore != null)
            {
                tableDropDown.Values = dataStore.Reader.TableAndViewNames.ToArray();
                if (tablesFilter != null && tablesFilter.Length > 0)
                {
                    tableDropDown.Values = tableDropDown.Values.Intersect(tablesFilter).ToArray();
                }
                checkpointDropDown.Values = dataStore.Reader.CheckpointNames.ToArray();
                if (checkpointDropDown.Values.Length > 0)
                {
                    checkpointDropDown.SelectedValue = checkpointDropDown.Values[0];
                }
                if (Utility.Configuration.Settings.MaximumRowsOnReportGrid > 0)
                {
                    statusLabel.Text = Utility.Configuration.Settings.MaximumRowsOnReportGrid.ToString();
                }
                tableDropDown.SelectedIndex = 0;
            }

            tableDropDown.Changed     += this.OnTableSelected;
            columnFilterEditBox.Leave += OnColumnFilterChanged;
            columnFilterEditBox.IntellisenseItemsNeeded += OnIntellisenseNeeded;
            rowFilterEditBox.Leave     += OnColumnFilterChanged;
            checkpointDropDown.Changed += OnCheckpointDropDownChanged;
            PopulateGrid();
        }
Esempio n. 6
0
        /// <summary>
        /// Attach the view to this presenter.
        /// </summary>
        /// <param name="model"></param>
        /// <param name="view"></param>
        /// <param name="explorerPresenter"></param>
        public void Attach(object zoneModel, object viewBase, ExplorerPresenter explorerPresent)
        {
            view              = (ViewBase)viewBase;
            model             = (IModel)zoneModel;
            explorerPresenter = explorerPresent;

            dataView         = view.GetControl <ListView>("dataListView");
            latitudeEditBox  = view.GetControl <EditView>("latitudeEditBox");
            longitudeEditBox = view.GetControl <EditView>("longitudeEditBox");
            countryDropDown  = view.GetControl <DropDownView>("countryDropDown");
            placeNameEditBox = view.GetControl <EditView>("placeNameEditBox");
            radiusEditBox    = view.GetControl <EditView>("radiusEditBox");
            searchButton     = view.GetControl <ButtonView>("searchButton");
            addSoilButton    = view.GetControl <ButtonView>("addSoilButton");
            apsoilButton     = view.GetControl <ButtonView>("apsoilButton");
            isricButton      = view.GetControl <ButtonView>("isricButton");

            PopulateView();

            searchButton.Clicked  += OnSearchClicked;
            addSoilButton.Clicked += OnAddSoilButtonClicked;
            apsoilButton.Clicked  += OnApsoilButtonClicked;
            isricButton.Clicked   += OnIsricButtonClicked;
        }
Esempio n. 7
0
        public override void Awake()
        {
            // This is to make it so nothing else can be interacted with.
            this.EncompassingView      = new View(main.GeeUI, main.GeeUI.RootView);
            this.MainView              = new PanelView(main.GeeUI, EncompassingView, Vector2.Zero);
            MainView.Resizeable        = false;
            MainView.AnchorPoint.Value = new Vector2(0.5f, 0.5f);
            MainView.Width.Value       = 400;
            MainView.Height.Value      = 400;

            this.EncompassingView.Add(new Binding <int, Point>(EncompassingView.Height, (p) => p.Y, main.ScreenSize));
            this.EncompassingView.Add(new Binding <int, Point>(EncompassingView.Width, (p) => p.X, main.ScreenSize));
            this.MainView.Add(new Binding <Vector2, int>(MainView.Position, i => new Vector2(i / 2f, MainView.Y), EncompassingView.Width));
            this.MainView.Add(new Binding <Vector2, int>(MainView.Position, i => new Vector2(MainView.X, i / 2f), EncompassingView.Height));

            new TextView(main.GeeUI, MainView, "Workshop entry:", new Vector2(10, 8));
            this.SelectFile = new DropDownView(main.GeeUI, MainView, new Vector2(10, 35));
            SelectFile.AddOption("[Fetching...]", null);
            this.SelectFile.Position.Value = new Vector2(10, 30);

            this.queryResult = SteamWorker.GetCreatedWorkShopEntries((entries) =>
            {
                SelectFile.RemoveAllOptions();
                SelectFile.AddOption("[new]", delegate()
                {
                    this.currentPublishedFile = default(SteamUGCDetails_t);
                    this.UploadButton.Text    = "Publish";
                    this.UploadButton.AllowMouseEvents.Value = true;
                    this.CloseButton.AllowMouseEvents.Value  = true;
                });
                var listEntries = entries as List <SteamUGCDetails_t>;
                if (listEntries == null)
                {
                    SelectFile.AddOption("[Error fetching entries]", null);
                    return;
                }
                foreach (var entry in listEntries)
                {
                    SteamUGCDetails_t entry1 = entry;
                    SelectFile.AddOption(entry.m_rgchTitle, () =>
                    {
                        this.currentPublishedFile = entry1;
                        this.NameView.Text        = entry1.m_rgchTitle;
                        this.DescriptionView.Text = entry1.m_rgchDescription;
                        this.UploadButton.Text    = "Update";
                        this.UploadButton.AllowMouseEvents.Value = true;
                        this.CloseButton.AllowMouseEvents.Value  = true;
                    }, related: entry);
                }
            });

            new TextView(main.GeeUI, MainView, "Name:", new Vector2(10, 68));
            this.NameView = new TextFieldView(main.GeeUI, MainView, new Vector2(10, 85))
            {
                MultiLine = false
            };
            new TextView(main.GeeUI, MainView, "Description:", new Vector2(10, 118));
            this.DescriptionView = new TextFieldView(main.GeeUI, MainView, new Vector2(10, 135));

            this.UploadButton = new ButtonView(main.GeeUI, MainView, "Publish", new Vector2(50, 360));
            this.CloseButton  = new ButtonView(main.GeeUI, MainView, "Close", new Vector2(300, 360));

            var statusString = new TextView(main.GeeUI, MainView, "Waiting", new Vector2(110, 365))
            {
                TextJustification = TextJustification.Center,
            };

            statusString.AutoSize.Value = false;
            statusString.Width.Value    = 190;

            ConfigureTextField(NameView);
            ConfigureTextField(DescriptionView);

            UploadButton.OnMouseClick += (sender, args) =>
            {
                DoUpload();
            };

            CloseButton.OnMouseClick += (sender, args) =>
            {
                this.Delete.Execute();
            };

            this.Add(new Binding <string>(statusString.Text, StatusString));

            base.Awake();
        }
Esempio n. 8
0
 public DdlController(DefaultMessageBus messageDispatcher, DropDownView dropDownView, UserView userView)
 {
     _messageDispatcher = messageDispatcher;
     _dropDownView      = dropDownView;
     _userView          = userView;
 }