Exemplo n.º 1
0
        public void InsertTemplate(string textWorkspace)
        {
            FrmDescription frmDescription = new FrmDescription(_frmMain)
            {
                Insert = true
            };

            if (!String.IsNullOrEmpty(textWorkspace))
            {
                frmDescription.TextWorkspace = textWorkspace;
                frmDescription.SetPropertiesWorkspace();
            }

            DialogResult result = frmDescription.ShowDialog();

            if (!result.Equals(DialogResult.OK))
            {
                return;
            }

            try
            {
                M4Core.Entities.Workspace workspace = new M4Core.Entities.Workspace
                {
                    Parent  = "Workspaces",
                    Text    = frmDescription.TextWorkspace,
                    Default = frmDescription.DefaultWorkspace
                };

                if (ListWorkspace.Instance(Program.LanguageDefault).Insert(workspace))
                {
                    _archiveName = frmDescription.TextWorkspace + ".xml";

                    SaveConfigMain();
                }
                else
                {
                    InsertTemplate(frmDescription.TextWorkspace);
                }
            }
            finally
            {
                WorkspaceLoaded = frmDescription.TextWorkspace;
            }
        }
Exemplo n.º 2
0
        private void BtnApplyClick(object sender, EventArgs e)
        {
            if (trvWorkspace.SelectedNode == null)
            {
                return;
            }
            FrmDescription frmDescription = new FrmDescription(_frmMain)
            {
                ParentWorkspace = (trvWorkspace.SelectedNode.Parent != null) ? trvWorkspace.SelectedNode.Parent.Text : null,
                TextWorkspace   = trvWorkspace.SelectedNode.Text,
                Insert          = false
            };

            if (trvWorkspace.SelectedNode.Value == null)
            {
                frmDescription.DefaultWorkspace = null;
            }
            else
            {
                frmDescription.DefaultWorkspace = (trvWorkspace.SelectedNode.Value.Equals("1")) ? true : false;
            }

            frmDescription.SetPropertiesWorkspace();
            //frmDescription.VisibleOptionDefault(trvWorkspace.SelectedNode.Value != null);

            if (frmDescription.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DeleteWorkspace(ListWorkspace._path + trvWorkspace.SelectedNode.Text + "\\");

            _archiveName = frmDescription.TextWorkspace.Trim().ToUpper() + ".xml";
            _archiveName = trvWorkspace.SelectedNode.Text + ".xml";

            SaveConfigMain();

            LoadDataWorkspace();
        }