示例#1
0
        public StartEventControl()
        {
            try{
                string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "background.png");
                if (File.Exists(file))
                {
                    bgPixbuf = new Gdk.Pixbuf(file);
                }

                this.Build();

                this.Events          = EventMask.AllEventsMask;
                this.ConfigureEvent += delegate(object o, ConfigureEventArgs args) {
                    Console.WriteLine("ConfigureEvent");
                };

                this.ResizeChecked += delegate(object sender, EventArgs e) {
                    Console.WriteLine("ResizeChecked");
                };

                this.ScreenChanged += delegate(object o, ScreenChangedArgs args) {
                    Console.WriteLine("ScreenChanged");
                };

                bannerImage.WidthRequest  = 400;
                bannerImage.HeightRequest = 120;
                table1.Attach(bannerImage, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
                LoadDefaultBanner();

                Thread BannerThread = new Thread(new ThreadStart(BannerThreadLoop));

                BannerThread.Name         = "BannerThread";
                BannerThread.IsBackground = true;
                BannerThread.Start();

                tblTwitt.WidthRequest  = 500;
                tblTwitt.HeightRequest = 130;

                lblWorkspace.ModifyFg(Gtk.StateType.Normal, new Color(90, 100, 110));
                lblProject.ModifyFg(Gtk.StateType.Normal, new Color(90, 100, 110));
                lblAccount.ModifyFg(Gtk.StateType.Normal, new Color(90, 100, 110));
                lbRecent.ModifyFg(Gtk.StateType.Normal, new Color(90, 100, 110));

                Pango.FontDescription customFont = lblTwiter.Style.FontDescription.Copy(); //  Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
                customFont.Size   = customFont.Size + (int)(customFont.Size / 2);          //24
                customFont.Weight = Pango.Weight.Bold;

                lblTwiter.ModifyFont(customFont);
                lblActions.ModifyFont(customFont);
                lblSamples.ModifyFont(customFont);
                lblContent.ModifyFont(customFont);
                lblTwiter.ModifyFg(Gtk.StateType.Normal, new Color(90, 100, 110));
                lblActions.ModifyFg(Gtk.StateType.Normal, new Color(90, 100, 110));
                lblSamples.ModifyFg(Gtk.StateType.Normal, new Color(90, 100, 110));
                lblContent.ModifyFg(Gtk.StateType.Normal, new Color(90, 100, 110));

                imgSamples.Pixbuf = MainClass.Tools.GetIconFromStock("logo74.png", IconSize.Button);
                imgTwiter.Pixbuf  = MainClass.Tools.GetIconFromStock("twitter24.png", IconSize.Button);
                imgActions.Pixbuf = MainClass.Tools.GetIconFromStock("actions24.png", IconSize.Button);
                imgContent.Pixbuf = MainClass.Tools.GetIconFromStock("content.png", IconSize.Button);

                btnTwitLoad.Label = MainClass.Languages.Translate("loading");
                this.ModifyBg(Gtk.StateType.Normal, Style.White);

                string file2 = System.IO.Path.Combine(MainClass.Paths.ResDir, "moscrif_background.png");                 //"moscrif.png");

                if (File.Exists(file2))
                {
                    logoPixbuf = new Gdk.Pixbuf(file2);
                }

                webCacheFile = WebCache.OpenWebCache(webCacheName);

                WebButton lb2 = new WebButton();
                lb2.Label = MainClass.Languages.Translate("new_workspace");
                //lb2.Description =MainClass.Languages.Translate("create_new_workspace");
                lb2.WidthRequest = 150;
                lb2.Clicked     += delegate(object sender, EventArgs e) {
                    new NewWorkspaceAction().Activate();
                };
                tblAction.Attach(lb2, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

                WebButton lb1 = new WebButton();
                lb1.Label = MainClass.Languages.Translate("open_workspace");
                //lb1.Description = MainClass.Languages.Translate("open_exist_workspace");
                lb1.WidthRequest = 150;
                lb1.Clicked     += delegate(object sender, EventArgs e) {
                    new OpenWorkspace().Activate();
                };
                tblAction.Attach(lb1, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

                WebButton lb3 = new WebButton();
                lb3.Label = MainClass.Languages.Translate("new_project");
                //lb3.Description = MainClass.Languages.Translate("create_new_file");
                lb3.WidthRequest = 150;
                lb3.Clicked     += delegate(object sender, EventArgs e) {
                    new NewProjectWizzardAction().Activate();
                };
                tblAction.Attach(lb3, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

                WebButton lb31 = new WebButton();
                lb31.Label = MainClass.Languages.Translate("import_project");
                //lb31.Description = MainClass.Languages.Translate("import_project_f1");
                lb31.WidthRequest = 150;
                lb31.Clicked     += delegate(object sender, EventArgs e) {
                    new ImportZipProjectAction().Activate();
                };
                tblAction.Attach(lb31, 1, 2, 3, 4, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);


                WebButton lb4 = new WebButton();
                lb4.Label = MainClass.Languages.Translate("open_file");
                //lb4.Description = MainClass.Languages.Translate("open_exist_file");
                lb4.WidthRequest = 150;
                lb4.Clicked     += delegate(object sender, EventArgs e) {
                    new OpenAction().Activate();
                };
                tblAction.Attach(lb4, 1, 2, 4, 5, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

                WebButton lb5 = new WebButton();
                lb5.Label = MainClass.Languages.Translate("login_logout");
                //lb5.Description = MainClass.Languages.Translate("login_logout");
                lb5.WidthRequest = 150;
                lb5.Clicked     += delegate(object sender, EventArgs e) {
                    MainClass.MainWindow.LoginLogout();
                };
                tblAction.Attach(lb5, 3, 4, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

                getRecentWorkspace();

                //getSamples();

                filllStartPageThread = new Thread(new ThreadStart(FilllStartPage));
                //filllStartPageThread.Priority = ThreadPriority.Normal;
                filllStartPageThread.Name         = "FilllStartPage";
                filllStartPageThread.IsBackground = true;
                filllStartPageThread.Start();

                LinkButton lbTutorial = new LinkButton();
                lbTutorial.Icon          = "tutorial.png";
                lbTutorial.UseWebStile   = false;
                lbTutorial.Label         = "Tutorials";
                lbTutorial.WidthRequest  = 150;
                lbTutorial.HeightRequest = 27;
                lbTutorial.LinkUrl       = MainClass.Settings.TutorialsBaseUrl;

                LinkButton lbVideos = new LinkButton();
                lbVideos.Icon          = "video.png";
                lbVideos.UseWebStile   = false;
                lbVideos.Label         = "Videos";
                lbVideos.WidthRequest  = 150;
                lbVideos.HeightRequest = 27;
                lbVideos.LinkUrl       = MainClass.Settings.VideosBaseUrl;

                LinkButton lbApi = new LinkButton();
                lbApi.Icon          = "api.png";
                lbApi.UseWebStile   = false;
                lbApi.Label         = "Api";
                lbApi.WidthRequest  = 150;
                lbApi.HeightRequest = 25;
                lbApi.LinkUrl       = MainClass.Settings.ApiBaseUrl;

                LinkButton lbShowcase = new LinkButton();
                lbShowcase.Icon          = "showcase.png";
                lbShowcase.UseWebStile   = false;
                lbShowcase.Label         = "Showcase";
                lbShowcase.WidthRequest  = 150;
                lbShowcase.HeightRequest = 27;
                lbShowcase.LinkUrl       = MainClass.Settings.ShowcaseBaseUrl;

                tblContent.WidthRequest = 500;
                tblContent.Attach(lbTutorial, 0, 1, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0);
                tblContent.Attach(lbVideos, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0);
                tblContent.Attach(lbApi, 2, 3, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0);
                tblContent.Attach(lbShowcase, 3, 4, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0);
                tblContent.ShowAll();
            } catch (Exception ex) {
                Tool.Logger.Error(ex.Message, null);
            }
        }