コード例 #1
0
        private void newScoreboardItem_Click(object sender, EventArgs e)
        {
            ScoreboardConfigForm configForm = new ScoreboardConfigForm();

            if (configForm.ShowDialog() == DialogResult.OK)
            {
                scoreboards.Add(configForm.ValueReturn);
                if (Settings.Default.Scoreboards == null)
                {
                    Settings.Default.Scoreboards = new System.Collections.Specialized.StringCollection()
                    {
                        configForm.ValueReturn.ToString()
                    }
                }
                ;
                else
                {
                    Settings.Default.Scoreboards.Add(configForm.ValueReturn.ToString());
                }

                configForm.ValueReturn.NewForm(this).Show();

                Settings.Default.Save();
            }
            configForm.Dispose();
        }
コード例 #2
0
        public ScoreboardForm(Scoreboard.Scoreboard info, Form1 parent)
        {
            InitializeComponent();
            ComponentResourceManager res = Utility.ApplySource(this);

            if (info.Name != "")
            {
                Text = info.Name;
            }
            Info = info;

            parent.ProjectOpen += Draw;
            LocationChanged    += ScoreboardForm_LocationChanged;
            ResizeEnd          += ScoreboardForm_ResizeEnd;
            StartPosition       = FormStartPosition.Manual;
            Size          = info.Size;
            ShowInTaskbar = false;

            Draw(parent.CurrentProject);

            ContextMenu = new ContextMenu();
            ContextMenu.MenuItems.Add(res.GetString("properties"), (e, g) =>
            {
                ScoreboardConfigForm configForm = new ScoreboardConfigForm(Info);
                switch (configForm.ShowDialog())
                {
                case DialogResult.OK:
                    Draw(LastProject);
                    break;

                case DialogResult.Abort:
                    Info.Removed        = true;
                    parent.ProjectOpen -= Draw;
                    LocationChanged    -= ScoreboardForm_LocationChanged;
                    ResizeEnd          -= ScoreboardForm_ResizeEnd;
                    if (LastDrawEvent != null)
                    {
                        parent.CurrentProject.OperationHeaderChanged -= LastDrawEvent;
                    }
                    Close();
                    break;
                }
                configForm.Dispose();
            });
        }