private void toolDeleteStyle_Click(object sender, EventArgs e) { if (ActiveStyle != null) { FormStyleManager.DeleteStyle(ActiveStyle); } }
private void SaveStyleLibrary() { saveFileDialog.FileName = FileName; if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { FormStyleManager.Save(saveFileDialog.FileName); ClearDirtyFlag(); FileName = saveFileDialog.FileName; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void OpenStyleLibrary() { openFileDialog.FileName = FileName; if (openFileDialog.ShowDialog() == DialogResult.OK) { try { FormStyleManager.Load(openFileDialog.FileName); FileName = openFileDialog.FileName; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
internal static FormStyle AddNewStyle() { FormStyle style = new FormStyle(); if (globalStyleLibrary == null) { globalStyleLibrary = new FormStyleLibrary(); } List <string> styleNames = new List <string>(FormStyleManager.GetStyleNames()); style.Name = "FormStyle"; for (int i = 1; styleNames.Contains(style.Name); i++) { style.Name = String.Format("FormStyle{0}", i); } globalStyleLibrary.Styles.Add(style); OnStyleChanged(); return(style); }
private void UpdateStyleList() { object selected = toolStyleList.SelectedItem; toolStyleList.Items.Clear(); string[] styles = FormStyleManager.GetStyleNames(); toolStyleList.Items.AddRange(styles); if (toolStyleList.Items.Count > 0) { if (selected != null) { toolStyleList.SelectedItem = selected; } if (toolStyleList.SelectedIndex < 0) { toolStyleList.SelectedIndex = 0; } } EnableTools(); }
private void UpdateActiveFormStyle() { FormStyle style = null; if (UseFormStyleManager) { // try to load specified style if (!String.IsNullOrEmpty(FormStyleName)) { style = FormStyleManager.GetStyle(FormStyleName); } // if it wasn't found try to load default style if (style == null) { style = FormStyleManager.GetDefaultStyle(); } } else { style = FormStyle; } ActiveFormStyle = style; }
private void toolAddStyle_Click(object sender, EventArgs e) { FormStyle style = FormStyleManager.AddNewStyle(); toolStyleList.SelectedItem = style.Name; }
private void toolStyleList_SelectedIndexChanged(object sender, EventArgs e) { ActiveStyle = FormStyleManager.GetStyle((string)toolStyleList.SelectedItem); }
private void NewStyle() { FormStyleManager.Reset(); }