Inheritance: MonoBehaviour
        void ReleaseDesignerOutlets()
        {
            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (PreferencesButton != null)
            {
                PreferencesButton.Dispose();
                PreferencesButton = null;
            }

            if (RefreshButton != null)
            {
                RefreshButton.Dispose();
                RefreshButton = null;
            }

            if (Content != null)
            {
                Content.Dispose();
                Content = null;
            }
        }
Exemplo n.º 2
0
        private void _ButtonDefault_Click(object sender, EventArgs e)
        {
            _ButtonDefault.Enabled = false;

            var accountPanels = this.Parent.Controls.All().Where(o => o is AccountPanel);

            Account      defaultAccount      = Config.Current.Accounts.Where(o => o.Default).FirstOrDefault();
            AccountPanel defaultAccountPanel = accountPanels.Where(o => (o as AccountPanel).Account.Default).FirstOrDefault() as AccountPanel;

            Forms.Preferences form = this.ParentForm as Forms.Preferences;

            PreferencesButton buttonAccounts = form._ButtonGroup.Controls.Find("_ButtonAccounts", true)[0] as PreferencesButton;

            PreferencesButtonItem thisItem    = buttonAccounts.ButtonItems.All().Where(o => o.AssociatedPanel == this).FirstOrDefault();
            PreferencesButtonItem defaultItem = buttonAccounts.ButtonItems.All().Where(o => o.ButtonText == defaultAccount.FullAddress).FirstOrDefault();

            defaultAccount.Default = false;
            Account.Default        = true;

            _ButtonDefault.Enabled = false;
            defaultAccountPanel.DefaultButton.Enabled = true;

            thisItem.Font    = new Font(thisItem.Font, FontStyle.Bold);
            defaultItem.Font = new Font(defaultItem.Font, FontStyle.Regular);
        }
Exemplo n.º 3
0
        private PreferencesButtonItem GetButtonItem()
        {
            Forms.Preferences form = this.ParentForm as Forms.Preferences;

            PreferencesButton     buttonAccounts = form._ButtonGroup.Controls.Find("_ButtonAccounts", true)[0] as PreferencesButton;
            PreferencesButtonItem thisItem       = buttonAccounts.ButtonItems.All().Where(o => o.AssociatedPanel == this).FirstOrDefault();

            return(thisItem);
        }
        private void InitButtons()
        {
            _ButtonAccounts   = new PreferencesButton();
            _ButtonAppearance = new PreferencesButton();

            _ButtonAccounts.AssociatedPanel = _PanelAccounts;
            _ButtonAccounts.ButtonText      = "Accounts";
            _ButtonAccounts.TabIndex        = 7;
            _ButtonAccounts.Name            = "_ButtonAccounts";

            _ButtonAppearance.AssociatedPanel = _PanelAppearance;
            _ButtonAppearance.ButtonText      = "Appearance";
            _ButtonAppearance.TabIndex        = 8;
            _ButtonAppearance.Name            = "_ButtonAppearance";

            // FlowLayoutPanel doesn't support visual inheritance, and ButtonGroup inherits from that, so we can't add
            // controls to it via the designer. Way to make it suck royal ass, Microsoft.
            _ButtonGroup.Controls.Add(_ButtonAccounts);
            _ButtonGroup.Controls.Add(_ButtonAppearance);
        }
Exemplo n.º 5
0
        private void _TaskButtonYes_Click(object sender, EventArgs e)
        {
            TaskDialogButton button = (TaskDialogButton)sender;

            Forms.Preferences form = this.ParentForm as Forms.Preferences;

            PreferencesButton     buttonAccounts = form._ButtonGroup.Controls.Find("_ButtonAccounts", true)[0] as PreferencesButton;
            PreferencesButtonItem thisItem       = buttonAccounts.ButtonItems.All().Where(o => o.AssociatedPanel == this).FirstOrDefault();

            ((TaskDialog)button.HostingDialog).Close();

            buttonAccounts.ButtonItems.Remove(thisItem);

            this.Parent.Controls.Remove(this);

            buttonAccounts.AssociatedPanel.Show();

            Config.Current.Accounts.Remove(this.Account);
            Config.Current.Save();
        }