public static WPF_GUI_Section add_TextBlock(this WPF_GUI_Section section, string text)
        {
            var textBlock = section.ContentPanel.add_TextBlock();

            textBlock.set_Text_Wpf(text);
            return(section);
        }
        public static WPF_GUI_Section add_Section(this List <WPF_GUI_Section> sections, string name, string introText)
        {
            var newSection = new WPF_GUI_Section(name, introText);

            sections.Add(newSection);
            return(newSection);
        }
 public static WPF_GUI_Section add_Link_O2Script(this WPF_GUI_Section section, string linkText, string o2ScriptToExecute)
 {
     return(section.add_Link(linkText,
                             () => {
         try
         {
             section.Wpf_Gui.show_O2Browser();
             var scriptPath = o2ScriptToExecute.local();
             if (scriptPath.fileExists())
             {
                 section.Wpf_Gui.showMessage("Executing script: {0}".format(o2ScriptToExecute), "");
                 section.Wpf_Gui.setExecuteScriptsEnvironment();
                 section.Wpf_Gui.ExecuteScripts.loadFile(scriptPath);
             }
             else
             {
                 section.Wpf_Gui.showMessage("Provided script not found: {0}".format(o2ScriptToExecute), "");
             }
         }
         catch (Exception ex)
         {
             ex.log("in WPF_GUI_Section.add_Link_O2Script");
         }
     }));
 }
 public static WPF_GUI_Section add_Link(this WPF_GUI_Section section, string linkText, Action onClick)
 {
     return((WPF_GUI_Section)section.SectionInGui.wpfInvoke(
                () => {
         section.ContentPanel.add_Xaml_Link(linkText, "20 0 0 10", onClick);
         return section;
     }));
 }
 public static WPF_GUI_Section add_Upgrade_Link(this WPF_GUI_Section section, string latestVersion, string upgradeLink)
 {
     if (PublicDI.config.CurrentExecutableDirectory.contains("OWASP O2 Platform") &&
         PublicDI.config.CurrentExecutableDirectory.contains(latestVersion).isFalse())
     {
         section.add_Label("There is an UPGRADE available", true);
         section.add_Link_Web("download version: {0}".format(latestVersion), upgradeLink);
     }
     return(section);
 }
        public static WPF_GUI_Section add_Link(this WPF_GUI_Section section, string linkText, Action <WinForms.Panel> onClickCtor)
        {
            Action <WinForms.Panel> pinnedCtor = onClickCtor;

            WinForms.Panel pinnedPanel = null;
            return((WPF_GUI_Section)section.SectionInGui.wpfInvoke(
                       () => {
                section.ContentPanel
                .add_Xaml_Link(linkText, "20 0 0 10",
                               () => {
                    if (pinnedPanel == null)
                    {
                        pinnedPanel = section.Wpf_Gui.WinFormPanel.add_Panel();
                        pinnedCtor(pinnedPanel);
                    }
                    section.Wpf_Gui.WinFormPanel.clear();
                    section.Wpf_Gui.WinFormPanel.add_Control(pinnedPanel);
                });
                return section;
            }));
        }
        public WPF_GUI_Section add_Section(WPF_GUI_Section section)
        {
            section.Wpf_Gui = this;
            return((WPF_GUI_Section)this.invokeOnThread(
                       () => {
                var outlookSection = new  OutlookSection();

                section.SectionInGui = outlookSection;
                outlookSection.Header = section.Name;
                var stackPanel = outlookSection.add_StackPanel();
                if (section.IntroText.valid())
                {
                    var textBlock = stackPanel.add_TextBlock();
                    textBlock.set_Text_Wpf(section.IntroText);
                }
                //section.ContentPanel = stackPanel.add_WrapPanel();
                section.ContentPanel = stackPanel.add_StackPanel();


                if (section.WinFormsCtor.notNull())
                {
                    section.WinFormsControl = section.WinFormsCtor();
                }

                outlookSection.Click +=
                    (sender, e) => {
                    if (section.WinFormsControl.notNull())
                    {
                        WinFormPanel.clear();
                        WinFormPanel.add_Control(section.WinFormsControl);
                    }
                };

                GUI_OutlookBar.Sections.Add(outlookSection);
                GuiSections.Add(section);
                return section;
            }));
        }
 public static WPF_GUI_Section add_Link_Process(this WPF_GUI_Section section, string linkText, string processToStart)
 {
     return(section.add_Link(linkText, () => section.Wpf_Gui.start_Process(processToStart)));
 }
 public static WPF_GUI_Section add_Link_O2Wiki(this WPF_GUI_Section section, string linkText, string wikiPageToShow)
 {
     return(section.add_Link(linkText, () => section.Wpf_Gui.show_O2Wiki(wikiPageToShow)));
 }
 public static WPF_GUI_Section add_Link_YouTube(this WPF_GUI_Section section, string linkText, string youTubeVideoId)
 {
     return(section.add_Link(linkText, () => section.Wpf_Gui.show_YouTubeVideo(youTubeVideoId)));
 }
 public static WPF_GUI_Section add_Link_Web(this WPF_GUI_Section section, string linkText, string linkUrl)
 {
     return(section.add_Link(linkText, () => section.Wpf_Gui.show_Url(linkUrl)));
 }
    	public static WPF_GUI_Section add_Section(this List<WPF_GUI_Section> sections, string name, string introText)
    	{
			var newSection = new WPF_GUI_Section(name, introText);
			sections.Add(newSection);
			return newSection;
    	}
 public static WPF_GUI_Section add_Label(this WPF_GUI_Section section, string labelText)
 {
     return(section.add_Label(labelText, false));
 }
 public static WPF_GUI_Section add_WrapPanel(this WPF_GUI_Section section)
 {
     section.ContentPanel = section.ContentPanel.add_WrapPanel();
     return(section);
 }
 public static WPF_GUI_Section add_Label(this WPF_GUI_Section section, string labelText, bool bold)
 {
     section.ContentPanel.add_Label_Wpf(labelText, bold);
     return(section);
 }
 public static List <Button> links(this WPF_GUI_Section section)
 {
     return(section.ContentPanel.controls_Wpf <Button>());
 }
    	public WPF_GUI_Section add_Section(WPF_GUI_Section section)
    	{
    		section.Wpf_Gui = this;
			return (WPF_GUI_Section)this.invokeOnThread(
    			()=>{
    					var outlookSection = new  OutlookSection();    				
    					
    					section.SectionInGui = outlookSection;
						outlookSection.Header = section.Name;
						var stackPanel = outlookSection.add_StackPanel();						
						if (section.IntroText.valid())
						{
							var textBlock = stackPanel.add_TextBlock();
							textBlock.set_Text_Wpf(section.IntroText);
						}
						//section.ContentPanel = stackPanel.add_WrapPanel();						
						section.ContentPanel = stackPanel.add_StackPanel();						
						
						
						if (section.WinFormsCtor.notNull())
						{
							section.WinFormsControl = section.WinFormsCtor();							
						}						
						
						outlookSection.Click+=
							(sender,e)=>{
											if (section.WinFormsControl.notNull())
											{
												WinFormPanel.clear();
												WinFormPanel.add_Control(section.WinFormsControl);												
											}
										};
						
						GUI_OutlookBar.Sections.Add(outlookSection);												
						GuiSections.Add(section);
						return section;
					});
		}