Пример #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;
				frm.ShowInTaskbar = false;
				
				if (frm.ShowDialog(WorkbenchSingleton.MainWin32Window) == 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();
				}
			}
		}
Пример #2
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.editor = ((ICSharpCode.SharpDevelop.Gui.StringListEditor)(target));
         return;
     }
     this._contentLoaded = true;
 }
Пример #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.stringListEditor = ((ICSharpCode.SharpDevelop.Gui.StringListEditor)(target));
                return;

            case 2:

            #line 27 "..\..\..\..\..\Src\Gui\Components\StringListEditorDialog.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
		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;
					}
				}
			}
		}