/// <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; organisationBox.Text = Utility.Configuration.Settings.Organisation; address1Box.Text = Utility.Configuration.Settings.Address1; address2Box.Text = Utility.Configuration.Settings.Address2; cityBox.Text = Utility.Configuration.Settings.City; stateBox.Text = Utility.Configuration.Settings.State; postcodeBox.Text = Utility.Configuration.Settings.Postcode; countryBox.Text = Utility.Configuration.Settings.Country; emailBox.Text = Utility.Configuration.Settings.Email; WebClient web = new WebClient(); string tempLicenseFileName = Path.Combine(Path.GetTempPath(), "APSIM_NonCommercial_RD_licence.htm"); if (File.Exists(tempLicenseFileName)) { File.Delete(tempLicenseFileName); } try { // web.DownloadFile(@"https://www.apsim.info/APSIM.Registration.Portal/APSIM_NonCommercial_RD_licence.htm", tempLicenseFileName); // HTMLview.SetContents(File.ReadAllText(tempLicenseFileName), false, true); htmlView.SetContents(@"https://www.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; } }
/// <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"); } }
/// <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; } } }