Пример #1
0
        void ShowLayoutEditor()
        {
            using (Form frm = new Form()) {
                frm.Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Title}");

                StringListEditor ed = new StringListEditor();
                ed.Dock               = DockStyle.Fill;
                ed.ManualOrder        = false;
                ed.BrowseForDirectory = false;
                ed.TitleText          = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Label}");
                ed.AddButtonText      = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.AddLayout}");

                ed.LoadList(CustomLayoutNames);
                FlowLayoutPanel p = new FlowLayoutPanel();
                p.Dock          = DockStyle.Bottom;
                p.FlowDirection = FlowDirection.RightToLeft;

                Button btn = new Button();
                p.Height         = btn.Height + 8;
                btn.DialogResult = DialogResult.Cancel;
                btn.Text         = ResourceService.GetString("Global.CancelButtonText");
                frm.CancelButton = btn;
                p.Controls.Add(btn);

                btn = new Button();
                btn.DialogResult = DialogResult.OK;
                btn.Text         = ResourceService.GetString("Global.OKButtonText");
                frm.AcceptButton = btn;
                p.Controls.Add(btn);

                frm.Controls.Add(ed);
                frm.Controls.Add(p);

                frm.FormBorderStyle = FormBorderStyle.FixedDialog;
                frm.MaximizeBox     = false;
                frm.MinimizeBox     = false;
                frm.ClientSize      = new System.Drawing.Size(400, 300);
                frm.StartPosition   = FormStartPosition.CenterParent;

                if (frm.ShowDialog(WorkbenchSingleton.MainForm) == DialogResult.OK)
                {
                    IList <string> oldNames = new List <string>(CustomLayoutNames);
                    IList <string> newNames = ed.GetList();
                    // add newly added layouts
                    foreach (string newLayoutName in newNames)
                    {
                        if (!oldNames.Contains(newLayoutName))
                        {
                            oldNames.Add(newLayoutName);
                            LayoutConfiguration.CreateCustom(newLayoutName);
                        }
                    }
                    // remove deleted layouts
                    LayoutConfiguration.Layouts.RemoveAll(delegate(LayoutConfiguration lc) {
                        return(lc.Custom && !newNames.Contains(lc.Name));
                    });
                    LayoutConfiguration.SaveCustomLayoutConfiguration();
                }
            }
        }
        void ChangeRuleAssembliesButtonClick(object sender, EventArgs e)
        {
            using (Form frm = new Form()) {
                frm.Text = changeRuleAssembliesButton.Text;

                StringListEditor ed = new StringListEditor();
                ed.Dock               = DockStyle.Fill;
                ed.ManualOrder        = false;
                ed.BrowseForDirectory = true;
                ed.AutoAddAfterBrowse = true;
                ed.TitleText          = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.ChooseRuleAssemblyDirectory}");

                ed.LoadList(GetRuleAssemblyList(false));
                FlowLayoutPanel p = new FlowLayoutPanel();
                p.Dock          = DockStyle.Bottom;
                p.FlowDirection = FlowDirection.RightToLeft;

                Button btn = new Button();
                p.Height         = btn.Height + 8;
                btn.DialogResult = DialogResult.Cancel;
                btn.Text         = ResourceService.GetString("Global.CancelButtonText");
                frm.CancelButton = btn;
                p.Controls.Add(btn);

                btn = new Button();
                btn.DialogResult = DialogResult.OK;
                btn.Text         = ResourceService.GetString("Global.OKButtonText");
                frm.AcceptButton = btn;
                p.Controls.Add(btn);

                frm.Controls.Add(ed);
                frm.Controls.Add(p);

                frm.FormBorderStyle = FormBorderStyle.FixedDialog;
                frm.MaximizeBox     = false;
                frm.MinimizeBox     = false;
                frm.ClientSize      = new Size(400, 300);
                frm.StartPosition   = FormStartPosition.CenterParent;

                if (frm.ShowDialog(FindForm()) == DialogResult.OK)
                {
                    StringBuilder b = new StringBuilder(DefaultRuleAssemblies);
                    foreach (string asm in ed.GetList())
                    {
                        b.Append(';');
                        b.Append(asm);
                    }
                    bool oldInitSuccess = initSuccess;
                    initSuccess = true;
                    try {
                        this.RuleAssemblies = b.ToString();
                    } finally {
                        initSuccess = oldInitSuccess;
                    }
                }
            }
        }
        private void EditIncludeFilters_Click(object sender, RoutedEventArgs e)
        {
            var editor = new StringListEditor {
                Owner = Application.Current.MainWindow
            };
            var model = (SubversionDefinitionEditorViewModel)DataContext;

            var result = editor.ShowDialog(model.IncludeFilter.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries));

            model.IncludeFilter = string.Join(";", result);
        }
Пример #4
0
		public override void LoadPanelContents()
		{
			InitializeHelper();
			
			StringListEditor editor = new StringListEditor();
			editor.BrowseForDirectory = true;
			editor.ListCaption = StringParser.Parse("&${res:Dialog.ProjectOptions.ReferencePaths}:");
			editor.TitleText = StringParser.Parse("&${res:Global.Folder}:");
			editor.AddButtonText = StringParser.Parse("${res:Dialog.ProjectOptions.ReferencePaths.AddPath}");
			editor.ListChanged += delegate { IsDirty = true; };
			SemicolonSeparatedStringListBinding b = new SemicolonSeparatedStringListBinding(editor);
			helper.AddBinding("ReferencePath", b);
			this.Controls.Add(editor);
			b.CreateLocationButton(editor);
			
			helper.AddConfigurationSelector(this);
		}
Пример #5
0
        public override void LoadPanelContents()
        {
            InitializeHelper();

            StringListEditor editor = new StringListEditor();

            editor.BrowseForDirectory = true;
            editor.ListCaption        = StringParser.Parse("&${res:Dialog.ProjectOptions.ReferencePaths}:");
            editor.TitleText          = StringParser.Parse("&${res:Dialog.ExportProjectToHtml.FolderLabel}");
            editor.AddButtonText      = StringParser.Parse("${res:Dialog.ProjectOptions.ReferencePaths.AddPath}");
            editor.ListChanged       += delegate { IsDirty = true; };
            SemicolonSeparatedStringListBinding b = new SemicolonSeparatedStringListBinding(editor);

            helper.AddBinding("ReferencePath", b);
            this.Controls.Add(editor);
            b.CreateLocationButton(editor);

            helper.AddConfigurationSelector(this);
        }
Пример #6
0
			public SemicolonSeparatedStringListBinding(StringListEditor editor)
			{
				this.editor = editor;
			}
Пример #7
0
 public SemicolonSeparatedStringListBinding(StringListEditor editor)
 {
     this.editor = editor;
 }