public About() { InitializeComponent(); HelperMethods.FixFonts(this); }
public FormMain() { //#if DEBUG // var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "RBSoft", // "Sales Manager", "database.smdb"); // if (File.Exists(databasePath)) // { // File.Delete(databasePath); // } //#endif InitializeComponent(); dateTimePickerFrom.Value = new DateTime(dateTimePickerTo.Value.Year, dateTimePickerTo.Value.Month, 1, 0, 0, 0); dateTimePickerTo.Value = dateTimePickerTo.Value.AbsoluteEnd(); dateTimePickerFrom.MaxDate = dateTimePickerTo.Value.AbsoluteStart(); HelperMethods.FixFonts(this); WindowSettings.Restore(Settings.Default.WindowSettings, this); Application.CurrentCulture = new CultureInfo("en-US") { NumberFormat = { CurrencyNegativePattern = 1 } }; objectListViewTransactions.RestoreState( Convert.FromBase64String(Settings.Default.ObjectListViewTransactionsState)); olvColumnDate.AspectGetter += delegate(object rowObject) { var transaction = rowObject as Transaction; return(transaction?.Date.ToString("d", Application.CurrentCulture) ?? DateTime.Now.ToString("d", Application.CurrentCulture)); }; objectListViewTransactions.AboutToCreateGroups += ObjectListViewTransactionsOnAboutToCreateGroups; objectListViewTransactions.BeforeCreatingGroups += (sender, args) => { args.Parameters.GroupComparer = args.Parameters.GroupByColumn.Equals(olvColumnDate) ? new GroupDateComparer(args.Parameters.PrimarySortOrder) : null; }; thirtyMinutesToolStripMenuItem.Checked = Settings.Default.AutoRefreshInterval.Equals(30 * 60 * 1000); oneHourToolStripMenuItem.Checked = Settings.Default.AutoRefreshInterval.Equals(60 * 60 * 1000); twoHourToolStripMenuItem.Checked = Settings.Default.AutoRefreshInterval.Equals(2 * 60 * 60 * 1000); threeHourToolStripMenuItem.Checked = Settings.Default.AutoRefreshInterval.Equals(3 * 60 * 60 * 1000); fourHourToolStripMenuItem.Checked = Settings.Default.AutoRefreshInterval.Equals(4 * 60 * 60 * 1000); enableUpdateNotificationToolStripMenuItem.Checked = Settings.Default.EnableUpdateNotification; minimizeToTrayToolStripMenuItem.Checked = Settings.Default.MinimizeToTray; using (var db = new SalesManagerContext()) { db.Database.EnsureCreated(); if (!db.Countries.Any()) { var referral = new Country { ID = 1, Name = "Referral", Tax = 0 }; db.Countries.Add(referral); db.SaveChanges(); } if (!db.Products.Any()) { var all = new Product { ID = 1, Name = "All", BuyerFee = 0, AuthorFee = 0, Price = 0, PartnerShare = 0, Account = null }; db.Products.Add(all); var referral = new Product { ID = 2, Name = "Referral", BuyerFee = 0, AuthorFee = 0, Price = 0, PartnerShare = 0, Account = null }; db.Products.Add(referral); db.SaveChanges(); } comboBoxProducts.DisplayMember = "Name"; comboBoxAccounts.DisplayMember = "Name"; } _timer = new Timer { Interval = Settings.Default.AutoRefreshInterval, Enabled = true }; _timer.Tick += toolStripButtonUpdate_Click; _timer.Start(); }