コード例 #1
0
        private void btnCreateMasterObject_Click(object sender, EventArgs e)
        {
            MasterObjectCreationForm creation = new MasterObjectCreationForm();
            DialogResult             dr       = creation.ShowDialog();

            if (dr == DialogResult.OK)
            {
                Library.Project            proj   = Library.Project.CurrentProject;
                MasterObjectCreationWindow window = new MasterObjectCreationWindow(creation.MasterObject);
                if (!creation.MasterObject.RelativeHeight)
                {
                    window.Height = (int)creation.MasterObject.Height;
                }
                else
                {
                    window.Height = 500;
                }
                if (!creation.MasterObject.RelativeWidth)
                {
                    window.Width = (int)creation.MasterObject.Width;
                }
                else
                {
                    window.Width = 500;
                }
                window.WindowState = FormWindowState.Normal;
                DialogResult dr2 = window.ShowDialog();
                if (dr2 == DialogResult.OK)
                {
                    string[] splitted = creation.MasterObject.Title.Split('/');
                    string   path     = String.Join("/", splitted.Take(splitted.Count() - 1).ToArray());
                    creation.MasterObject.Title = splitted.Last();
                    proj.Add(creation.MasterObject, path);
                    Library.Project.Save(proj, ConfigDirectories.GetDocumentsFolder(), AppDomain.CurrentDomain.GetData("fileName").ToString());
                    proj.ReloadProject();
                }
                int index = this.cmbMasterObjects.Items.Add(creation.txtTitle.Text);
                this.cmbMasterObjects.Text = creation.txtTitle.Text;
            }
        }
コード例 #2
0
        private void créerToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            MasterObjectCreationForm creation = new MasterObjectCreationForm();
            DialogResult             dr       = creation.ShowDialog();

            if (dr == DialogResult.OK)
            {
                Project proj = Project.CurrentProject;
                MasterObjectCreationWindow window = new MasterObjectCreationWindow(creation.MasterObject);
                if (creation.MasterObject.ConstraintWidth == EnumConstraint.FIXED)
                {
                    window.Width = (int)creation.MasterObject.Width;
                }
                else
                {
                    window.Height = 500;
                }
                if (creation.MasterObject.ConstraintHeight == EnumConstraint.FIXED)
                {
                    window.Height = (int)creation.MasterObject.Height;
                }
                else
                {
                    window.Height = 500;
                }
                window.WindowState = FormWindowState.Normal;
                DialogResult dr2 = window.ShowDialog();
                if (dr2 == DialogResult.OK)
                {
                    string[] splitted = creation.MasterObject.ElementTitle.Split('/');
                    string   path     = String.Join("/", splitted.Take(splitted.Count() - 1));
                    creation.MasterObject.Name = splitted.Last();
                    proj.Add(creation.MasterObject, path);
                    Project.Save(proj, ConfigDirectories.GetDocumentsFolder(), AppDomain.CurrentDomain.GetData("fileName").ToString());
                    Project.CurrentProject.ReloadProject();
                }
            }
        }