Beispiel #1
0
        /// <summary>
        /// Populates all controls on the form.
        /// </summary>
        private void PopulateForm()
        {
            listmodel.Clear();
            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            try
            {
                PopulateUpgradeList();
            }
            catch (Exception)
            {
                MasterView.ShowMsgDialog("Cannot download the upgrade list.\nEither the server is down or your network connection is broken.", "Error", MessageType.Error, ButtonsType.Ok, window1);
                loadFailure = true;
                return;
            }
            if (upgrades.Length > 0)
            {
                label1.Text = "You are currently using version " + version.ToString() + ". Newer versions are listed below.";
                label1.Text = label1.Text + Environment.NewLine + "Select an upgrade below.";
            }
            else
            {
                label1.Text = "You are currently using version " + version.ToString() + ". You are using the latest version.";
            }


            firstNameBox.Text    = Utility.Configuration.Settings.FirstName;
            lastNameBox.Text     = Utility.Configuration.Settings.LastName;
            emailBox.Text        = Utility.Configuration.Settings.Email;
            organisationBox.Text = Utility.Configuration.Settings.Organisation;
            countryBox.Active    = Constants.Countries.ToList().IndexOf(Utility.Configuration.Settings.Country);

            WebClient web = new WebClient();

            string tempLicenseFileName = Path.Combine(Path.GetTempPath(), "APSIM_NonCommercial_RD_licence.htm");

            if (File.Exists(tempLicenseFileName))
            {
                File.Delete(tempLicenseFileName);
            }

            if (version.Build == 0)
            {
                button1.Sensitive = false;
                table2.Hide();
                checkbutton1.Hide();
                licenseView.Text = "You are currently using a custom build - **Upgrade is not available!**";
            }
            else
            {
                licenseView.Text = ReflectionUtilities.GetResourceAsString("ApsimNG.LICENSE.md");
            }
        }
Beispiel #2
0
        private void LoadGUI(object sender, EventArgs e)
        {
            InitTimer();                                //progress timer

            AllocConsole();                             //enables console
            JsonCommon.OverrideModInstallerVariables(); //overrides vars if possible

            //check if in vs
            string dir = Directory.GetCurrentDirectory();

            for (int i = 0; i < 3; i++)
            {
                dir = Directory.GetParent(dir).ToString(); //move up 3 dirs
            }
            dir += @"\bin\";                               //add bin
            Console.WriteLine(ModInstallerCommon.Files.MainFiledir);
            Console.WriteLine("Detecting for" + ModInstallerCommon.Files.execdir);
            if (!File.Exists(ModInstallerCommon.Files.execdir) && !ModInstallerCommon.BypassExec && !Directory.Exists(dir))
            {
                MessageBox.Show("ModInstaller cannot find the executable! Make sure my location is in a folder inside the h3vr directory! Just in case, I'll pull up a tutorial for you.", "Exectuable not found!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                var psi = new ProcessStartInfo
                {
                    FileName        = "https://youtu.be/LBcxS_mYLFE?t=21",
                    UseShellExecute = true
                };
                Process.Start(psi);
                Application.Exit();
            }

            var onlineversion = new Version(JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo).Modlist[0].Version);

            if (ModInstallerCommon.ModInstallerVersion.CompareTo(onlineversion) < 0)
            {
                MessageBox.Show("H3VRModInstaller is out of date! (" + ModInstallerCommon.ModInstallerVersion + " vs " + onlineversion + ")", "Wrong version detected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                var psi = new ProcessStartInfo
                {
                    FileName        = JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo).Modlist[0].Website,
                    UseShellExecute = true
                };
                Process.Start(psi);
            }

            InstallButton.Hide();
            UpdateButton.Hide();
            ModVer.Hide();
            Delete.Hide();
            CheckButton.Hide();
            InstalledModsList.Hide();

            ModsEnabled.Checked = true;
            UpdateModList();
            UpdateCatagories();
        }
Beispiel #3
0
        private void LoadGUI(object sender, EventArgs e)
        {
            AllocConsole();

            InstallButton.Hide();
            UpdateButton.Hide();
            ModVer.Hide();
            Delete.Hide();
            CheckButton.Hide();
            InstalledModsList.Hide();

            ModsEnabled.Checked = true;
            UpdateModList();
            UpdateCatagories();
        }
Beispiel #4
0
        private void LoadGUI(object sender, EventArgs e)
        {
            KeyDown += Form_KeyDown;

            if (!File.Exists(Utilities.ModCache))
            {
                MessageBox.Show("Thank you for downloading H3VRModInstaller!\nIf there are any issues, or if you want a mod added, please hit us up on the Homebrew discord (@Frityet and @Potatoes)", "Thank you!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            InitTimer();                                //progress timer
            //AllocConsole(); //enables console
            JsonCommon.OverrideModInstallerVariables(); //overrides vars if possible

            var onlineversion = new Version(JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo)
                                            .Modlist[0].Version);

            if (ModInstallerCommon.ModInstallerVersion.CompareTo(onlineversion) < 0)
            {
                MessageBox.Show("H3VRModInstaller is out of date! (" + ModInstallerCommon.ModInstallerVersion + " vs " + onlineversion + ")", "Out of date version detected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                var psi = new ProcessStartInfo
                {
                    FileName = JsonModList.GetDeserializedModListFormatOnline(JsonCommon.DatabaseInfo)
                               .Modlist[0]
                               .Website,
                    UseShellExecute = true
                };
                Process.Start(psi);
            }

            InstallButton.Hide();
            UpdateButton.Hide();
            ModVer.Hide();
            Delete.Hide();
            CheckButton.Hide();
            UpdateModList();
            UpdateCatagories();

            CatagoriesComboBox.SelectedIndex = 0;
        }
Beispiel #5
0
        private void LoadGUI(object sender, EventArgs e)
        {
            KeyDown += Form_KeyDown;

            if (!File.Exists(Utilities.ModCache))
            {
                MessageBox.Show("Thank you for downloading H3VRModInstaller!\nIf there are any issues, or if you want a mod added, please hit us up on the Homebrew discord (@Frityet and @Potatoes)", "Thank you!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            InitTimer(); //progress timer
            //AllocConsole(); //enables console

            InstallButton.Hide();
            UpdateButton.Hide();
            ModVer.Hide();
            Delete.Hide();
            CheckButton.Hide();
            UpdateModList();
            UpdateCatagories();
            DisEnaButton.Hide();

            CatagoriesComboBox.SelectedIndex = 0;
        }
Beispiel #6
0
        private void Build()
        {
            WindowPosition = WindowPosition.CenterOnParent;
            Resizable      = false;

            const int spacing = 6;
            var       hbox1   = new HBox()
            {
                Spacing = spacing
            };

            hbox1.PackStart(new Label(Translations.GetString("Transfer Map")), false, false, 0);
            hbox1.PackStart(new HSeparator(), true, true, 0);
            ContentArea.PackStart(hbox1, false, false, 0);

            var hbox2 = new HBox()
            {
                Spacing = spacing
            };

            comboMap = new ComboBoxText();
            comboMap.AppendText(Translations.GetString("RGB"));
            comboMap.AppendText(Translations.GetString("Luminosity"));
            comboMap.Active = 1;
            hbox2.PackStart(comboMap, false, false, 0);

            labelPoint = new Label("(256, 256)");
            var labelAlign = new Alignment(1, 0.5f, 1, 0);

            labelAlign.Add(labelPoint);
            hbox2.PackEnd(labelAlign, false, false, 0);
            ContentArea.PackStart(hbox2, false, false, 0);

            drawing = new DrawingArea()
            {
                WidthRequest  = 256,
                HeightRequest = 256,
                Events        = (Gdk.EventMask) 795646,
                CanFocus      = true
            };
            ContentArea.PackStart(drawing, false, false, 8);

            var hbox3 = new HBox();

            checkRed = new CheckButton(Translations.GetString("Red  "))
            {
                Active = true
            };
            checkGreen = new CheckButton(Translations.GetString("Green"))
            {
                Active = true
            };
            checkBlue = new CheckButton(Translations.GetString("Blue "))
            {
                Active = true
            };
            hbox3.PackStart(checkRed, false, false, 0);
            hbox3.PackStart(checkGreen, false, false, 0);
            hbox3.PackStart(checkBlue, false, false, 0);

            buttonReset = new Button()
            {
                WidthRequest  = 81,
                HeightRequest = 30,
                Label         = Translations.GetString("Reset")
            };
            hbox3.PackEnd(buttonReset, false, false, 0);
            ContentArea.PackStart(hbox3, false, false, 0);

            labelTip = new Label(Translations.GetString("Tip: Right-click to remove control points."));
            ContentArea.PackStart(labelTip, false, false, 0);

            ContentArea.ShowAll();
            checkRed.Hide();
            checkGreen.Hide();
            checkBlue.Hide();
        }
Beispiel #7
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UpgradeView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.UpgradeView.glade");

            window1         = (Window)builder.GetObject("window1");
            button1         = (Button)builder.GetObject("button1");
            button2         = (Button)builder.GetObject("button2");
            table1          = (Table)builder.GetObject("table1");
            table2          = (Table)builder.GetObject("table2");
            firstNameBox    = (Entry)builder.GetObject("firstNameBox");
            lastNameBox     = (Entry)builder.GetObject("lastNameBox");
            organisationBox = (Entry)builder.GetObject("organisationBox");
            emailBox        = (Entry)builder.GetObject("emailBox");
            countryBox      = (ComboBox)builder.GetObject("countryBox");
            label1          = (Label)builder.GetObject("label1");
            htmlAlign       = (Alignment)builder.GetObject("HTMLalign");
            checkbutton1    = (CheckButton)builder.GetObject("checkbutton1");
            listview1       = (Gtk.TreeView)builder.GetObject("listview1");
            alignment7      = (Alignment)builder.GetObject("alignment7");
            oldVersions     = (CheckButton)builder.GetObject("checkbutton2");
            listview1.Model = listmodel;

            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            if (version.Revision == 0)
            {
                button1.Sensitive = false;
                table2.Hide();
                checkbutton1.Hide();
            }

            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;

            TreeViewColumn column0 = new TreeViewColumn("Version", textRender, "text", 0);

            listview1.AppendColumn(column0);
            column0.Sizing    = TreeViewColumnSizing.Autosize;
            column0.Resizable = true;

            TreeViewColumn column1 = new TreeViewColumn("Description", textRender, "text", 1);

            listview1.AppendColumn(column1);
            column1.Sizing    = TreeViewColumnSizing.Autosize;
            column1.Resizable = true;

            // Populate the combo box with a list of valid country names.
            ListStore countries = new ListStore(typeof(string));

            foreach (string country in Constants.Countries)
            {
                countries.AppendValues(country);
            }
            countryBox.Model = countries;

            // Add a cell renderer to the combo box.
            CellRendererText cell = new CellRendererText();

            countryBox.PackStart(cell, false);
            countryBox.AddAttribute(cell, "text", 0);

            // Make the tab order a little more sensible than the defaults
            table1.FocusChain = new Widget[] { alignment7, button1, button2 };
            table2.FocusChain = new Widget[] { firstNameBox, lastNameBox, emailBox, organisationBox, countryBox };

            htmlView = new HTMLView(new ViewBase(null));
            htmlAlign.Add(htmlView.MainWidget);
            tabbedExplorerView = owner as IMainView;

            window1.TransientFor = owner.MainWidget.Toplevel as Window;
            window1.Modal        = true;
            oldVersions.Toggled += OnShowOldVersionsToggled;
            button1.Clicked     += OnUpgrade;
            button2.Clicked     += OnViewMoreDetail;
            window1.Destroyed   += OnFormClosing;
            window1.MapEvent    += OnShown;
        }
Beispiel #8
0
        /// <summary>
        /// Populates all controls on the form.
        /// </summary>
        private void PopulateForm()
        {
            listmodel.Clear();
            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            try
            {
                PopulateUpgradeList();
            }
            catch (Exception)
            {
                MasterView.ShowMsgDialog("Cannot download the upgrade list.\nEither the server is down or your network connection is broken.", "Error", MessageType.Error, ButtonsType.Ok, window1);
                loadFailure = true;
                return;
            }
            if (upgrades.Length > 0)
            {
                label1.Text = "You are currently using version " + version.ToString() + ". Newer versions are listed below.";
                label1.Text = label1.Text + Environment.NewLine + "Select an upgrade below.";
            }
            else
            {
                label1.Text = "You are currently using version " + version.ToString() + ". You are using the latest version.";
            }


            firstNameBox.Text    = Utility.Configuration.Settings.FirstName;
            lastNameBox.Text     = Utility.Configuration.Settings.LastName;
            emailBox.Text        = Utility.Configuration.Settings.Email;
            organisationBox.Text = Utility.Configuration.Settings.Organisation;
            countryBox.Active    = Constants.Countries.ToList().IndexOf(Utility.Configuration.Settings.Country);

            WebClient web = new WebClient();

            string tempLicenseFileName = Path.Combine(Path.GetTempPath(), "APSIM_NonCommercial_RD_licence.htm");

            if (File.Exists(tempLicenseFileName))
            {
                File.Delete(tempLicenseFileName);
            }

            if (version.Revision == 0)
            {
                button1.Sensitive = false;
                table2.Hide();
                checkbutton1.Hide();
                htmlView.SetContents("<center><span style=\"color:red\"><b>WARNING!</b></span><br/>You are currently using a custom build<br/><b>Upgrade is not available!</b></center>", false, false);
            }
            else
            {
                try
                {
                    // web.DownloadFile(@"https://apsimdev.apsim.info/APSIM.Registration.Portal/APSIM_NonCommercial_RD_licence.htm", tempLicenseFileName);
                    // HTMLview.SetContents(File.ReadAllText(tempLicenseFileName), false, true);
                    htmlView.SetContents(@"https://apsimdev.apsim.info/APSIM.Registration.Portal/APSIM_NonCommercial_RD_licence.htm", false, true);
                }
                catch (Exception)
                {
                    ViewBase.MasterView.ShowMsgDialog("Cannot download the license.", "Error", MessageType.Error, ButtonsType.Ok, window1);
                    loadFailure = true;
                }
            }
        }