示例#1
0
        private void ctxUserControlBase_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            try
            {
                setThemeToolStripMenuItem.DropDownItems.Clear();

                var themes = UserThemeRepository.GetThemes();

                foreach (Theme theme in themes.OrderBy(t => t.Name))
                {
                    var themeName = (theme.Id == State.ThemeId) ?
                                    $"[{theme.Name}]" :
                                    theme.Name;

                    var themeMenuItem = new ToolStripMenuItem(themeName);
                    themeMenuItem.Tag    = theme;
                    themeMenuItem.Click += selectThemeToolStripMenuItem_Click;
                    setThemeToolStripMenuItem.DropDownItems.Add(themeMenuItem);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        protected virtual void ReloadThemeList()
        {
            try
            {
                Themes = UserThemeRepository.GetThemes().Where(t => t.IsApplicationType == false).ToList();
                PopulateThemeList();

                lstThemes.SelectedIndex = -1;
                lstThemes.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error loading theme list", ex);
            }
        }
示例#3
0
        public void InitializeView(ViewState state)
        {
            State = state;

            lblHeader.Text = state.HeaderText;

            lblHeader.Visible = state.ListSettings.ShowHeader;

            tipDescription.SetToolTip(lblHeader, this.State.Description);

            tipDescription.SetToolTip(pnlDetail, this.State.Description);

            InitializeGridRows(state.ListSettings);

            _theme = UserThemeRepository.GetThemeOrDefault(State.ThemeId);

            ApplyTheme(_theme);
        }
示例#4
0
        private void cboThemes_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (chkApplyTheme.Checked && cboThemes.SelectedValue != null)
                {
                    var theme = UserThemeRepository.GetThemeOrDefault((Guid)cboThemes.SelectedValue);

                    if (theme != null)
                    {
                        ApplyTheme(theme);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error selecting theme", ex);
            }
        }
示例#5
0
        private void chkApplyTheme_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (chkApplyTheme.Checked)
                {
                    var theme = UserThemeRepository.GetThemeOrDefault((Guid)cboThemes.SelectedValue);

                    ApplyTheme(theme);
                }
                else
                {
                    ApplyTheme(_blankTheme);
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error applying theme", ex);
            }
        }
示例#6
0
        private void CreateViewWizard4_Load(object sender, EventArgs e)
        {
            lblCaption.Text = Caption;

            lblViewTitle.Text = NewViewNamePrompt;

            _viewContainerBackColor = pnlListView.BackColor;

            _fieldsFont  = pnlFields.Font;
            _fields1Font = pnlFields1.Font;
            _captionFont = pnlCaptions.Font;
            _titleFont   = pnlViewTitle.Font;

            _fieldsBackColor  = pnlFields.BackColor;
            _fields1BackColor = pnlFields1.BackColor;
            _captionBackColor = pnlCaptions.BackColor;
            _titleBackColor   = pnlViewTitle.BackColor;

            _fieldsForeColor  = pnlFields.ForeColor;
            _fields1ForeColor = pnlFields1.ForeColor;
            _captionForeColor = pnlCaptions.ForeColor;
            _titleForeColor   = pnlViewTitle.ForeColor;

            btnSaveView.DataBindings.Add(new Binding("Enabled", this, "CanSave"));

            _themes = new List <Theme>();
            _themes.Add(new Theme()
            {
                Name = "None", Id = Guid.Empty
            });

            var userThemes = UserThemeRepository.GetThemes();

            _themes.AddRange(userThemes.OrderBy(t => t.Name));

            DisplayThemeList();

            _evenPanels.Add(pnlFields);
            _evenPanels.Add(ClonePanel(pnlFields));
            _evenPanels.Add(ClonePanel(pnlFields));
            _evenPanels.Add(ClonePanel(pnlFields));

            _oddPanels.Add(pnlFields1);
            _oddPanels.Add(ClonePanel(pnlFields1));
            _oddPanels.Add(ClonePanel(pnlFields1));
            _oddPanels.Add(ClonePanel(pnlFields1));

            for (int i = 2; i < _evenPanels.Count + _evenPanels.Count; i++)
            {
                var evenOdd = i % 2;
                var idx     = (int)(i / 2);

                if (evenOdd == 1)
                {
                    pnlListView.Controls.Add(_oddPanels[idx]);
                }
                else
                {
                    pnlListView.Controls.Add(_evenPanels[idx]);
                }
            }
        }
        private void btnExportThemes_Click(object sender, EventArgs e)
        {
            var currentThemes = UserThemeRepository.GetThemes();

            UserThemeRepository.ExportThemes(currentThemes);
        }