コード例 #1
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            // Create a new instance of the child form.
            DataForm childForm = new DataForm();

            // Make it a child of this MDI form before showing it.
            childForm.MdiParent    = this;
            childForm.Disposed    += new EventHandler(childForm_Disposed);
            childForm.saveAsEvent += new SaveAsEventHandler(childForm_saveAsEvent);
            childFormNumber++;
            bool success = childForm.CrateNewData();

            if (success)
            {
                if (this.childFormNumber == 1)
                {
                    this.welcomeScreen.Hide();
                }

                childForm.Show();
                childForm.WindowState = FormWindowState.Maximized;
            }
            else
            {
                childForm.Dispose();
            }
        }
コード例 #2
0
        public void OpenFile(string filePath)
        {
            // Create a new instance of the child form.
            DataForm childForm = new DataForm();

            // Make it a child of this MDI form before showing it.
            childForm.MdiParent = this;
            childForm.Disposed += new EventHandler(childForm_Disposed);
            childFormNumber++;
            bool success = childForm.OpenFile(filePath);

            if (success)
            {
                if (this.childFormNumber == 1)
                {
                    this.welcomeScreen.Hide();
                }
                childForm.Show();
                childForm.WindowState = FormWindowState.Maximized;

                //add to recent items
                if (this.recentItem.Contains(childForm.FilePath))
                {
                    this.recentItem.RemoveAt(this.recentItem.IndexOf(childForm.FilePath));
                    this.recentItem.Add(childForm.FilePath);
                }
                else
                {
                    if (this.recentItem.Count == 10)
                    {
                        this.recentItem.RemoveAt(0);
                    }
                    this.recentItem.Add(childForm.FilePath);
                }
                welcomeScreen.UpdateRecentItem();
                this.writeRecentListFile();
            }
            else
            {
                childForm.Dispose();
            }
        }
コード例 #3
0
        public void OpenFile(string filePath)
        {
            // Create a new instance of the child form.
            DataForm childForm = new DataForm();
            // Make it a child of this MDI form before showing it.
            childForm.MdiParent = this;
            childForm.Disposed += new EventHandler(childForm_Disposed);
            childFormNumber++;
            bool success = childForm.OpenFile(filePath);
            if (success)
            {
                if (this.childFormNumber == 1)
                    this.welcomeScreen.Hide();
                childForm.Show();
                childForm.WindowState = FormWindowState.Maximized;

                //add to recent items
                if (this.recentItem.Contains(childForm.FilePath))
                {
                    this.recentItem.RemoveAt(this.recentItem.IndexOf(childForm.FilePath));
                    this.recentItem.Add(childForm.FilePath);
                }
                else
                {
                    if (this.recentItem.Count == 10) this.recentItem.RemoveAt(0);
                    this.recentItem.Add(childForm.FilePath);
                }
                welcomeScreen.UpdateRecentItem();
                this.writeRecentListFile();
            }
            else
            {
                childForm.Dispose();
            }
        }
コード例 #4
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            // Create a new instance of the child form.
            DataForm childForm = new DataForm();
            // Make it a child of this MDI form before showing it.
            childForm.MdiParent = this;
            childForm.Disposed += new EventHandler(childForm_Disposed);
            childForm.saveAsEvent += new SaveAsEventHandler(childForm_saveAsEvent);
            childFormNumber++;
            bool success = childForm.CrateNewData();
            if (success)
            {
                if (this.childFormNumber == 1)
                    this.welcomeScreen.Hide();

                childForm.Show();
                childForm.WindowState = FormWindowState.Maximized;

            }
            else
            {
                childForm.Dispose();
            }
        }