コード例 #1
0
 public static void launchGui()
 {
     O2Thread.mtaThread(() => API_Blogger.buildGui());
 }
コード例 #2
0
    	private static API_Blogger buildGui()
    	{
    		var panel = O2Gui.open<Panel>("O2 Platform Blogger API", 800,600);
	   	panel.clear();
 
			var hostPanel = panel.add_1x1("write","live view",false);
			var newPostBody = (O2BrowserIE)hostPanel[0].add_O2_Browser_IE();
			var optionsTab = newPostBody.insert_Above<TabControl>(100);
			var bloggerView = hostPanel[1].add_IE();
			var bloggerApi = new API_Blogger(bloggerView);
 
			var newPostTitle = newPostBody.insert_Above<Panel>(20)
										  .add_Label("New post Title:")
										  .top(2)
										  .append_TextBox("");
			newPostTitle.align_Right(optionsTab);
 
			var postTitle = "title";
			var postBody = "body";
			newPostTitle.set_Text(postTitle);
			newPostBody.open(postBody.saveWithExtension(".html")); 
			newPostBody.editMode(); 
			newPostTitle.onTextChange((text)=>	postTitle = text);		
			newPostBody.onTextChange((html) =>	postBody = html.htmlDocument().select("//body").innerHtml().str().trim());
 
 
			var actionsTab= optionsTab.add_Tab("Actions");  
			var credentialsFile = actionsTab.add_Label("Use credentials from file:",5,0)
										    .append_TextBox(defaultCredentialsFile);
			credentialsFile.align_Right(actionsTab);							   
 
			var credentialsType = actionsTab.add_Label("Credential Type:              ",30,0) 
					 					    .append_TextBox(defaultCredentialsType);
			credentialsType.align_Right(actionsTab);
 
 
 
 
			var loginLink = actionsTab.add_Link("login", 55,130,
				()=>{
						if (credentialsFile.get_Text().fileExists())
							bloggerApi.login(credentialsFile.get_Text()
										   .credential(credentialsType.get_Text()));
						else
							bloggerApi.login();
					}); 
 
			loginLink.append_Link("logout", ()=> bloggerApi.logout())
					 .append_Link("dashboard",()=> bloggerApi.dashboard())
					 .append_Link("new post page",()=> bloggerApi.newPost())
					 .append_Link("preview new post",
						()=>{
								bloggerApi.setNewPostContents(postTitle, postBody);
								bloggerApi.viewPreview();
							})
					 .append_Link("submit new post",()=> bloggerApi.publishPost());
 
 
 
			bloggerApi.dashboard();
			return bloggerApi;
    	}
コード例 #3
0
        private static API_Blogger buildGui()
        {
            var panel = O2Gui.open <Panel>("O2 Platform Blogger API", 800, 600);

            panel.clear();

            var hostPanel   = panel.add_1x1("write", "live view", false);
            var newPostBody = (O2BrowserIE)hostPanel[0].add_O2_Browser_IE();
            var optionsTab  = newPostBody.insert_Above <TabControl>(100);
            var bloggerView = hostPanel[1].add_IE();
            var bloggerApi  = new API_Blogger(bloggerView);

            var newPostTitle = newPostBody.insert_Above <Panel>(20)
                               .add_Label("New post Title:")
                               .top(2)
                               .append_TextBox("");

            newPostTitle.align_Right(optionsTab);

            var postTitle = "title";
            var postBody  = "body";

            newPostTitle.set_Text(postTitle);
            newPostBody.open(postBody.saveWithExtension(".html"));

            newPostBody.editMode();
            newPostTitle.onTextChange((text) => postTitle = text);
            newPostBody.onTextChange((html) => postBody   = html.htmlDocument().select("//body").innerHtml().str().trim());


            var actionsTab      = optionsTab.add_Tab("Actions");
            var credentialsFile = actionsTab.add_Label("Use credentials from file:", 5, 0)
                                  .append_TextBox(defaultCredentialsFile);

            credentialsFile.align_Right(actionsTab);

            var credentialsType = actionsTab.add_Label("Credential Type:              ", 30, 0)
                                  .append_TextBox(defaultCredentialsType);

            credentialsType.align_Right(actionsTab);



            var loginLink = actionsTab.add_Link("login", 55, 130,
                                                () => {
                if (credentialsFile.get_Text().fileExists())
                {
                    bloggerApi.login(credentialsFile.get_Text()
                                     .credential(credentialsType.get_Text()));
                }
                else
                {
                    bloggerApi.login();
                }
            });

            loginLink.append_Link("logout", () => bloggerApi.logout())
            .append_Link("dashboard", () => bloggerApi.dashboard())
            .append_Link("new post page", () => bloggerApi.newPost())
            .append_Link("preview new post",
                         () => {
                bloggerApi.setNewPostContents(postTitle, postBody);
                bloggerApi.viewPreview();
            })
            .append_Link("submit new post", () => bloggerApi.publishPost());



            bloggerApi.dashboard();
            return(bloggerApi);
        }