Example #1
0
 public static void fin()
 {
     if (GenerateManager.sInstance != null)
     {
         GenerateManager.sInstance = null;
     }
 }
Example #2
0
 public static void init()
 {
     if (GenerateManager.sInstance == null)
     {
         GenerateManager.sInstance = new GenerateManager();
     }
 }
Example #3
0
        private void onClosing(object sender, CancelEventArgs e)
        {
            GenerateManager.fin();

            if (this.ProjectPathTextBlock.Text != "N/A")
            {
                Properties.Settings.Default.ProjectPath = this.ProjectPathTextBlock.Text;
            }

            Properties.Settings.Default.SpecifyAuthor          = this.SpecifyAuthorCheckBox.IsChecked.Value;
            Properties.Settings.Default.Author                 = this.AuthorTextBox.Text;
            Properties.Settings.Default.WithIncludeGuard       = this.WithIncludeGuardCheckBox.IsChecked.Value;
            Properties.Settings.Default.WithNamespace          = this.WithNamespaceCheckBox.IsChecked.Value;
            Properties.Settings.Default.Namespace              = this.NamespaceTextBox.Text;
            Properties.Settings.Default.UseSpaceForIndentation = this.UseSpaceForIndentationCheckBox.IsChecked.Value;

            Properties.Settings.Default.Save();
        }
Example #4
0
        private void onLoaded(object sender, RoutedEventArgs e)
        {
            GenerateManager.init();

            var sList = GenerateManager.Instance.getGeneratorList();

            sList.Sort();

            this.TargetTypeComboBox.Items.Clear();

            foreach (var sPair in sList)
            {
                this.TargetTypeComboBox.Items.Add(sPair.Key);
            }

            if (this.TargetTypeComboBox.Items.Count != 0)
            {
                this.TargetTypeComboBox.SelectedIndex = 0;
            }

            if (Properties.Settings.Default.ProjectPath.Length == 0)
            {
                this.sProjectPathDialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                this.ProjectPathTextBlock.Text       = "N/A";
            }
            else
            {
                this.sProjectPathDialog.SelectedPath = Properties.Settings.Default.ProjectPath;
                this.ProjectPathTextBlock.Text       = Properties.Settings.Default.ProjectPath;
            }

            this.SpecifyAuthorCheckBox.IsChecked = Properties.Settings.Default.SpecifyAuthor;
            this.AuthorTextBox.Text = Properties.Settings.Default.Author;
            this.WithIncludeGuardCheckBox.IsChecked = Properties.Settings.Default.WithIncludeGuard;
            this.WithNamespaceCheckBox.IsChecked    = Properties.Settings.Default.WithNamespace;
            this.NamespaceTextBox.Text = Properties.Settings.Default.Namespace;
            this.UseSpaceForIndentationCheckBox.IsChecked = Properties.Settings.Default.UseSpaceForIndentation;

            if (this.SpecifyAuthorCheckBox.IsChecked.Value)
            {
                this.AuthorTextBox.Effect    = null;
                this.AuthorTextBox.IsEnabled = true;
            }
            else
            {
                this.AuthorTextBox.Effect    = this.sBlurEffect;
                this.AuthorTextBox.IsEnabled = false;
            }

            if (this.WithIncludeGuardCheckBox.IsChecked.Value)
            {
                this.IncludeGuardTextBox.Effect    = null;
                this.IncludeGuardTextBox.IsEnabled = true;
            }
            else
            {
                this.IncludeGuardTextBox.Effect    = this.sBlurEffect;
                this.IncludeGuardTextBox.IsEnabled = false;
            }

            if (this.WithNamespaceCheckBox.IsChecked.Value)
            {
                this.NamespaceTextBox.Effect    = null;
                this.NamespaceTextBox.IsEnabled = true;
            }
            else
            {
                this.NamespaceTextBox.Effect    = this.sBlurEffect;
                this.NamespaceTextBox.IsEnabled = false;
            }

            this.updateProjectPath();
            this.updateTargetName();
            this.updateAuthorName();
            this.updateIncludeGuard();
            this.updateNamespace();
            this.updateGenerateButton();

            if (this.sProjectPathError == null && this.sTargetNameError == null && this.sNamespaceError == null)
            {
                this.IncludeGuardTextBox.Text = MainWindow.convertTargetName2IncludeGuard(this.TargetTypeComboBox.Text, this.NamespaceTextBox.Text, this.TargetNameTextBox.Text);
            }
            else
            {
                this.IncludeGuardTextBox.Text = string.Empty;
            }
        }