Пример #1
0
        /// <summary>
        /// Sets the workspace you want to edit.
        /// </summary>
        /// <param name="ws">The workspace which will be edited.</param>
        internal void EditWorkspace(Workspace ws)
        {
            _workspace = ws;

            this.nameTextBox.Text            = ws.Name;
            this.languageComboBox.Text       = ws.Language;
            this.XMLTextBox.Text             = ws.MetaFilename;
            this.workspaceTextBox.Text       = Path.GetDirectoryName(ws.FileName);
            this.sourceTextBox.Text          = ws.SourceFolder;
            this.exportTextBox.Text          = ws.DefaultExportFolder;
            this.typesExportTextBox.Text     = ws.GetExportAbsoluteFolder(ws.Language);
            this.useIntValueCheckBox.Checked = ws.UseIntValue;

            if (string.IsNullOrEmpty(this.languageComboBox.Text))
            {
                this.languageComboBox.SelectedIndex = 0;
            }

            this.workspaceTextBox.Enabled = false;
            this.workspaceButton.Enabled  = false;

            this._filename = ws.FileName;

            this.Text = Resources.WorkspaceEditTiltle;

            SetSourceLanguage();

            checkButtons();

            setMetaVisible(ws.Version <= 0);
        }
Пример #2
0
        /// <summary>
        /// Sets the workspace you want to edit.
        /// </summary>
        /// <param name="ws">The workspace which will be edited.</param>
        internal void EditWorkspace(Workspace ws)
        {
            _workspace = ws;

            // Fill the form.
            this.nameTextBox.Text        = ws.Name;
            this.languageComboBox.Text   = ws.Language;
            this.XMLTextBox.Text         = ws.XMLFolder;
            this.workspaceTextBox.Text   = Path.GetDirectoryName(ws.FileName);
            this.sourceTextBox.Text      = ws.Folder;
            this.exportTextBox.Text      = ws.DefaultExportFolder;
            this.typesExportTextBox.Text = ws.GetExportAbsoluteFolder(ws.Language);

            if (string.IsNullOrEmpty(this.languageComboBox.Text))
            {
                this.languageComboBox.SelectedIndex = 0;
            }

            this.workspaceTextBox.Enabled = false;
            this.workspaceButton.Enabled  = false;

            this._filename = ws.FileName;

            this.Text = Resources.WorkspaceEditTiltle;

            // Add all xml files into the listbox.
            if (!string.IsNullOrEmpty(ws.XMLFolder))
            {
                DirectoryInfo dirInfo   = new DirectoryInfo(Directory.GetCurrentDirectory());
                string        xmlFolder = ws.XMLFolder;

                if (!Path.IsPathRooted(ws.XMLFolder))
                {
                    xmlFolder = Path.GetFullPath(xmlFolder);
                }

                if (!Directory.Exists(ws.XMLFolder))
                {
                    Directory.CreateDirectory(ws.XMLFolder);
                }

                string[] files = Directory.GetFiles(xmlFolder, "*.xml", SearchOption.TopDirectoryOnly);
                foreach (string file in files)
                {
                    string filename = Path.GetFileName(file);
                    pluginListBox.Items.Add(filename, ws.XMLPlugins.Contains(filename));
                }
            }

            SetSourceLanguage();

            checkButtons();
        }