/// <summary> /// Read setting from application setting json file (decided not to do StartupProject) /// </summary> private void ReadApplicationSettingsFile() { using (var file = File.OpenText(_applicationSettingsFile)) { var serializer = new JsonSerializer(); var applicationSettings = (ApplicationSettings)serializer.Deserialize(file, typeof(ApplicationSettings)); if (!string.IsNullOrWhiteSpace(applicationSettings.LastServerName)) { ServerNameTextBox.Text = applicationSettings.LastServerName; } var dataProvider = new DatabaseProviders(); ProviderComboBox.DataSource = dataProvider.List; if (!string.IsNullOrWhiteSpace(applicationSettings.DataProvider)) { if (ProviderComboBox.DataSource != null) { var index = ProviderComboBox.FindString(applicationSettings.DataProvider); if (index > -1) { ProviderComboBox.SelectedIndex = index; } } } _scaffoldBuilder = new ScaffoldBuilder(applicationSettings.LastServerName); } }
private void LoadData() { try { if (!DesignMode) { using (StreamReader reader = File.OpenText(Settings.LanguageMappingFile)) { settings.LoadXml(reader.ReadToEnd()); if (settings != null) { PopulateProviders(); } } } int index = ProviderComboBox.FindString(Settings.Driver); if (index != -1) { ProviderComboBox.SelectedIndex = index; } } catch { } }
/// <summary> /// Update application json file /// </summary> private void SaveApplicationSettings() { var applicationSettings = new ApplicationSettings() { LastServerName = ServerNameTextBox.Text, StartupProject = StartupProjectTextBox.Text }; ProviderComboBox.Invoke(new Action(() => applicationSettings.DataProvider = ProviderComboBox.Text)); using (var file = File.CreateText(_applicationSettingsFile)) { var serializer = new JsonSerializer { Formatting = Formatting.Indented }; serializer.Serialize(file, applicationSettings); } }
public SchedulingCalendar(int patientID, ProviderMain providerMain, PatientHomePage patientHome) { InitializeComponent(); monthView1.MonthTitleColor = monthView1.MonthTitleColorInactive = CalendarColorTable.FromHex("#C2DAFC"); monthView1.ArrowsColor = CalendarColorTable.FromHex("#77A1D3"); monthView1.DaySelectedBackgroundColor = CalendarColorTable.FromHex("#F4CC52"); monthView1.DaySelectedTextColor = monthView1.ForeColor; this.MdiParent = providerMain; this.thisPatientID = patientID; this.WindowState = FormWindowState.Maximized; ProviderComboBox.Hide(); SelectProviderLabel.Hide(); this.thisProviderID = providerMain.GetProviderID(); panel1.Hide(); this.patientHome = patientHome; Type = "Provider"; }
public SchedulingCalendar(string providerID, ProviderMain providerMain) { InitializeComponent(); this.thisProviderID = providerID; this.MdiParent = providerMain; providerIDList.Add(thisProviderID); //Monthview colors monthView1.MonthTitleColor = monthView1.MonthTitleColorInactive = CalendarColorTable.FromHex("#C2DAFC"); monthView1.ArrowsColor = CalendarColorTable.FromHex("#77A1D3"); monthView1.DaySelectedBackgroundColor = CalendarColorTable.FromHex("#F4CC52"); monthView1.DaySelectedTextColor = monthView1.ForeColor; //Initialize only double clicking for physicians this.calendar1.ItemDoubleClick += new System.Windows.Forms.Calendar.Calendar.CalendarItemEventHandler(this.calendar1_ItemDoubleClick); this.providerMain = providerMain ?? new ProviderMain(thisProviderID, thisProviderID); ProviderComboBox.Hide(); SelectProviderLabel.Hide(); panel1.Hide(); calendar1.Location = new Point(213, 0); calendar1.Dock = DockStyle.Top; calendar1.SetViewRange(DateTime.Today, DateTime.Today.Add(new TimeSpan(7, 0, 0, 0))); this.MdiParent = providerMain; this.WindowState = FormWindowState.Maximized; Type = "Provider"; CancelButton2.Hide(); }