Пример #1
0
 public static WPF_GUI setExecuteScriptsEnvironment(this WPF_GUI wpf_Gui)
 {
     if (wpf_Gui.ExecuteScripts.isNull())
     {
         wpf_Gui.ExecuteScripts = new ascx_Execute_Scripts();
         wpf_Gui.ExecuteScripts.csharpCompiler_OnAstOk =
             () => wpf_Gui.showMessage("Executing script: {0}".format(wpf_Gui.ExecuteScripts.currentScript.fileName()), "Ast was created Ok");
         wpf_Gui.ExecuteScripts.csharpCompiler_OnAstFail =
             () => {
             var scriptName = wpf_Gui.ExecuteScripts.currentScript.fileName();
             wpf_Gui.showMessage("Executing script: {0}".format(scriptName), "Ast Creation Failed!", wpf_Gui.scriptHelpPage(scriptName));
         };
         wpf_Gui.ExecuteScripts.csharpCompiler_OnCompileFail =
             () => {
             var compilationErrors = wpf_Gui.ExecuteScripts.csharpCompiler.compilationErrors();
             var errorMessage      = "Compilation Failed!".line() +
                                     "<br><hr><h4>".line() +
                                     compilationErrors.Replace("".line(), "<br>") +
                                     "</h4><hr>".line();
             wpf_Gui.showMessage("Executing script: {0}".format(wpf_Gui.ExecuteScripts.currentScript.fileName()), errorMessage);
         };
         wpf_Gui.ExecuteScripts.csharpCompiler_OnCompileOk =
             () => {
             var scriptName = wpf_Gui.ExecuteScripts.currentScript.fileName();
             wpf_Gui.showMessage("Executing script: {0}".format(scriptName), "Compiled OK, executing first method", wpf_Gui.scriptHelpPage(scriptName));
         };
     }
     return(wpf_Gui);
 }
        public MediaWikiEditor buildGui()
        {
            WpfGui = this.add_Control <WPF_GUI>();
            WpfGui.buildGui();
            buildGui_Internal(WpfGui.WinFormPanel);

            showLogViewer();

            WpfGui.add_Section("Media Wiki Editor", "Welcome to the O2 MediaWiki Editor")
            //.add_Link("Help",showHelp)
            .add_Link("Login", showLoginPanel)
            .add_Link("Edit Page", showEditPage)
            .add_Link("Edit using Categories", showEditUsingCategories)
            .add_Link("Edit Uncategorized Pages", showEditUncategorizedPages)
            .add_Link("Edit Category Pages", showEditCategoryPages)
            .add_Link("Edit Template Pages", showEditTemplatePages)
            .add_Link("Edit ALL Pages", showEditAllPages)
            .add_Link("Edit Users", showEditUsers)
            .add_Link("Util: Raw WikiText", showRawWikiText)
            .add_Link("Util: Backup", showBackup)
            .add_Link("Util: Show O2 Log Viewer", showLogViewer);

/*			if(WikiApi.loggedIn())
 *                              WpfGui.GuiSections[0].links().name("Edit Page").click();
 *                      else
 *                              WpfGui.GuiSections[0].links().name("Login").click();
 */
            //showLoginPanel();	// default page
            //WpfGui.show_O2Browser();
            //WpfGui.show_O2Wiki(helpPageInO2PlatformWiki);
            return(this);
        }
Пример #3
0
 public static WPF_GUI show_O2Browser(this WPF_GUI wpf_Gui)
 {
     if (wpf_Gui.WinFormPanel.controls().contains(wpf_Gui.O2Browser).isFalse())
     {
         wpf_Gui.WinFormPanel.clear();
         wpf_Gui.WinFormPanel.add_Control(wpf_Gui.O2Browser);
     }
     return(wpf_Gui);
 }
Пример #4
0
 public static WPF_GUI showFirstWinFormsPanel(this WPF_GUI wpf_Gui)
 {
     foreach (var section in wpf_Gui.GuiSections)
     {
         if (section.WinFormsControl.notNull())
         {
             wpf_Gui.WinFormPanel.clear()
             .add_Control(section.WinFormsControl);
         }
     }
     return(wpf_Gui);
 }
Пример #5
0
 public static WPF_GUI show_Url(this WPF_GUI wpf_Gui, string url)
 {
     wpf_Gui.show_O2Browser();
     wpf_Gui.statusMessage("Showing URL:{0}", url);
     if (url.uri().HEAD())
     {
         wpf_Gui.O2Browser.open(url);
     }
     else
     {
         wpf_Gui.showOffineMessage("Could not open url: {0}".format(url));
     }
     return(wpf_Gui);
 }
Пример #6
0
        public static WPF_GUI show_YouTubeVideo(this WPF_GUI wpf_Gui, string youTubeVideoId)
        {
            wpf_Gui.statusMessage("Showing YouTube Video with Id:{0}", youTubeVideoId);
            wpf_Gui.WinFormPanel.clear();
            wpf_Gui.WinFormPanel.add_Control(wpf_Gui.O2Browser);
            var code = ("<html><body cellspacing=\"0\" cellpadding=\"0\">" +
                        "<object><param name=\"movie\" width=\"450\" height=\"380\" " +
                        "value=\"http://www.youtube.com/v/{0}&amp;hl=en_GB&amp;fs=1\"></param><param name=\"allowFullScreen\" " +
                        "value=\"false\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed " +
                        "src=\"http://www.youtube.com/v/{0}&amp;hl=en_GB&amp;fs=1\" type=\"application/x-shockwave-flash\" " +
                        "allowscriptaccess=\"always\" allowfullscreen=\"false\" width=\"450\" height=\"380\"></embed></object>" +
                        "</body></html>")
                       .format(youTubeVideoId);

            wpf_Gui.O2Browser.set_Text(code);
            return(wpf_Gui);
        }
Пример #7
0
        public static WPF_GUI showMessage(this WPF_GUI wpf_Gui, WinForms.WebBrowser browser, string title, string message, string url)
        {
            O2Thread.mtaThread(
                () => {
                var htmlMessage = ("<html><body cellspacing=\"0\" cellpadding=\"0\"><font face=Arial><center>".line() +
                                   "   <h2>{1}</h2>".line() +
                                   "   <h3>{2}</h3>".line() +
                                   "   <img src=\"{0}\"/>" +
                                   "</center>".line() +
                                   ((url).valid()
                                                                                        ? "<div style=\"position:absolute; bottom:0px;width:100%;font-size:xx-small;\"><center>showing help page: <a href=\"{3}\"target=blank>{3}</a></center></div>".line() +
                                    "<iframe src =\"{3}\" style=\"position:absolute; bottom:15px; height=70%; width:100%;\"/>".line()

                                                                                        : "") +
                                   "</font></body></html>")
                                  .format("O2Logo_Small.gif".local(), title, message, url);
                browser.set_Text(htmlMessage);
            });
            return(wpf_Gui);
        }
Пример #8
0
 public static WPF_GUI showMessage(this WPF_GUI wpf_Gui, WinForms.WebBrowser browser, string title, string message)
 {
     return(wpf_Gui.showMessage(title, message, ""));
 }
Пример #9
0
 public static WPF_GUI showMessage(this WPF_GUI wpf_Gui, string title, string message, string url)
 {
     wpf_Gui.show_O2Browser();
     return(wpf_Gui.showMessage(wpf_Gui.O2Browser, title, message, url));
 }
Пример #10
0
 public static WPF_GUI showMessage(this WPF_GUI wpf_Gui, string title, string message)
 {
     return(wpf_Gui.showMessage(title, message, ""));
 }
Пример #11
0
 public static WPF_GUI showOffineMessage(this WPF_GUI wpf_Gui, WinForms.WebBrowser browser, string message)
 {
     return(wpf_Gui.showMessage(browser, "You are offline at the moment", message));
 }
Пример #12
0
 public static WPF_GUI showOffineMessage(this WPF_GUI wpf_Gui, string message)
 {
     wpf_Gui.show_O2Browser();
     return(wpf_Gui.showOffineMessage(wpf_Gui.O2Browser, message));
 }
Пример #13
0
 public static WPF_GUI start_Process(this WPF_GUI wpf_Gui, string processToStart)
 {
     wpf_Gui.statusMessage("Starting process: {0}", processToStart);
     Processes.startProcess(processToStart);
     return(wpf_Gui);
 }
Пример #14
0
 public static WPF_GUI show_O2Wiki(this WPF_GUI wpf_Gui, string wikiPageToShow)
 {
     wpf_Gui.statusMessage("Showing O2Platform Wiki page: {0}", wikiPageToShow);
     wpf_Gui.O2Browser.set_Text(wpf_Gui.Wiki_O2.html(wikiPageToShow));    //"O2_Videos_on_YouTube"));
     return(wpf_Gui);
 }
		public MediaWikiEditor buildGui()
		{
			WpfGui = this.add_Control<WPF_GUI>();
			WpfGui.buildGui();			
			buildGui_Internal(WpfGui.WinFormPanel);
			
			showLogViewer();
			
			WpfGui.add_Section("Media Wiki Editor", "Welcome to the O2 MediaWiki Editor")
				  //.add_Link("Help",showHelp)
				  .add_Link("Login",showLoginPanel)
				  .add_Link("Edit Page", showEditPage)
				  .add_Link("Edit using Categories", showEditUsingCategories)
				  .add_Link("Edit Uncategorized Pages", showEditUncategorizedPages)
				  .add_Link("Edit Category Pages", showEditCategoryPages)
				  .add_Link("Edit Template Pages", showEditTemplatePages)
				  .add_Link("Edit ALL Pages", showEditAllPages)
				  .add_Link("Edit Users", showEditUsers)
				  .add_Link("Util: Raw WikiText", showRawWikiText)
				  .add_Link("Util: Backup",showBackup)
				  .add_Link("Util: Show O2 Log Viewer",showLogViewer);
			
/*			if(WikiApi.loggedIn())
				WpfGui.GuiSections[0].links().name("Edit Page").click(); 	
			else
				WpfGui.GuiSections[0].links().name("Login").click(); 
*/				
			//showLoginPanel();	// default page		
			//WpfGui.show_O2Browser();
			//WpfGui.show_O2Wiki(helpPageInO2PlatformWiki);
			return this;
		}