void initDataSources() { data = new DataSources(meters); }
public void Init(List<Meter> meters, int refresh, int opacity, int fixedH, Color backColor, Color textColor, VertAlign align, bool topMost, bool transparent, Font font, DataSources data, Action LoadMeters, Action LoadOptions, Action InitData, Func<string, Image> LoadImg, Action<Image> DisposeImg) { initiating = true; this.data = data; this.LoadMeters = LoadMeters; this.LoadOptions = LoadOptions; this.InitData = InitData; this.LoadImg = LoadImg; this.DisposeImg = DisposeImg; //copy meters list this.meters = meters; listMeters.Items.Clear(); foreach (Meter meter in meters) listMeters.Items.Add(meter.Data); //load system fonts comboFont.Items.Clear(); foreach (FontFamily fontFamily in System.Drawing.FontFamily.Families) comboFont.Items.Add(fontFamily.Name); //display general options numRefresh.Value = refresh; numOpacity.Value = opacity; numFixedH.Value = fixedH; picBackColor.BackColor = backColor; picTextColor.BackColor = textColor; comboVertAlign.Text = align.ToString(); checkTopMost.Checked = topMost; checkTransparent.Checked = transparent; comboFont.Text = font.Name; numFontSize.Value = (int)font.Size; checkFontBold.Checked = font.Bold; checkFontItalic.Checked = font.Italic; checkFontUnderline.Checked = font.Underline; checkFontStrikeout.Checked = font.Strikeout; //note current values of general options this.refresh = refresh; this.opacity = opacity; this.fixedH = fixedH; this.backColor = backColor; this.textColor = textColor; this.align = align; this.topMost = topMost; this.transparent = transparent; this.font = font; //runs at startup? RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); if (rkApp.GetValue("SysMana") != null) checkRunAtStartup.Checked = true; initiating = false; buttMeterSaveChanges.Enabled = false; buttOptionsSaveChanges.Enabled = false; }