Ejemplo n.º 1
0
        internal void SaveProject(Project p)
        {
            try {
                /*XmlWriterSettings xmlSettings = new XmlWriterSettings();

                xmlSettings.NewLineChars = "\n";//Environment.NewLine;
                xmlSettings.Indent = true;
                xmlSettings.CloseOutput = true;

                XmlSerializer x_serial = new XmlSerializer( typeof( Project ) );
                using (XmlWriter wr = XmlWriter.Create( p.FilePath, xmlSettings )) {
                    x_serial.Serialize( wr, p );
                }

                XmlSerializer x_serial_PU = new XmlSerializer( typeof( ProjectUserFile ) );
                using (XmlWriter wr = XmlWriter.Create( p.ProjectUserSetting.FilePath, xmlSettings )) {
                    x_serial_PU.Serialize( wr, p.ProjectUserSetting );
                }*/
                p.Save();
            } catch (Exception ex) {
                MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("error_saving"), ex.Message, Gtk.MessageType.Error);
                md.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        public PublishDialogWizzard()
        {
            project  = MainClass.Workspace.ActualProject;
            this.TransientFor = MainClass.MainWindow;
            this.Build();

            ciDeviceTesting = new DropDownButton.ComboItem(MainClass.Languages.Translate("device_testing"),0);
            ciDeviceDistribution = new DropDownButton.ComboItem(MainClass.Languages.Translate("market_distribution"),1);

            btnResetMatrix.Label = MainClass.Languages.Translate("reset_matrix");

            chbSignApp= new CheckButton( MainClass.Languages.Translate("sign_app"));
            chbSignApp.Active = MainClass.Workspace.SignApp;
            chbSignApp.Toggled += new EventHandler(OnChbSignAppToggled);
            chbSignApp.Sensitive = true;//MainClass.Settings.SignAllow;

            notebook1.ShowTabs = false;
            notebook1.ShowBorder = false;
            notebook1.Page = 0;

            Table tblHeader = new Table(1,4,false);

            ddbTypPublish = new DropDownRadioButton();
            ddbTypPublish.Changed+= delegate(object sender, DropDownButton.ChangedEventArgs e)
            {
                if(e.Item !=null){
                    int selTyp = (int)e.Item;
                    if(selTyp == 0){
                        lblRemote.Visible = true;
                        ddbTypRemote.Visible = true;
                        chbSignApp.Sensitive= false;
                    } else {
                        if(!MainClass.LicencesSystem.CheckFunction("marketdistribution",this)){
                            ddbTypPublish.SelectItem(publishItems,ciDeviceTesting);
                            return;
                        }

                        lblRemote.Visible = false;
                        ddbTypRemote.Visible = false;
                        chbSignApp.Sensitive= true;
                    }

                    MainClass.Workspace.ActualProject.TypPublish = selTyp;
                }
            };
            ddbTypPublish.WidthRequest = 175;
            ddbTypPublish.SetItemSet(publishItems);

            ddbTypRemote = new DropDownRadioButton();
            ddbTypRemote.Changed+= delegate(object sender, DropDownButton.ChangedEventArgs e)
            {
                if(e.Item !=null){
                    string ipAdress = (string)e.Item;
                    MainClass.Settings.RemoteIpAdress = ipAdress;
                }
            };

            ddbTypRemote.WidthRequest = 175;
            ddbTypRemote.SetItemSet(remoteItems);

            publishItems.Add(ciDeviceTesting);
            publishItems.Add(ciDeviceDistribution);

            ddbTypPublish.SelectItem(publishItems,ciDeviceTesting);
            /*if(MainClass.Workspace.ActualProject.TypPublish ==1)
                ddbTypPublish.SelectItem(publishItems,ciDeviceDistribution);
            else
                ddbTypPublish.SelectItem(publishItems,ciDeviceTesting);*/

            DropDownButton.ComboItem addRemote0 = new DropDownButton.ComboItem(MainClass.Languages.Translate("remote_none"),"0");
            remoteItems.Add(addRemote0);

            bool findSelect = false;
            List<string> listIp = Moscrif.IDE.Tool.Network.GetIpAdress();
            foreach (string ip in listIp){
                DropDownButton.ComboItem addIP = new DropDownButton.ComboItem(ip,ip);
                remoteItems.Add(addIP);
                /*if(ip== MainClass.Settings.RemoteIpAdress){
                    ddbTypRemote.SelectItem(remoteItems,addIP);
                    findSelect = true;
                }*/
            }
            if(!findSelect){
                ddbTypRemote.SelectItem(remoteItems,addRemote0);;
            }

            tblHeader.Attach(new Label("Publish: "),0,1,0,1,AttachOptions.Fill,AttachOptions.Fill,5,0);
            tblHeader.Attach(ddbTypPublish,1,2,0,1,AttachOptions.Fill,AttachOptions.Fill,0,0);

            tblHeader.Attach(lblRemote,2,3,0,1,AttachOptions.Fill,AttachOptions.Fill,5,0);
            tblHeader.Attach(ddbTypRemote,3,4,0,1,AttachOptions.Fill,AttachOptions.Fill,0,0);

            this.vbox2.PackStart(tblHeader,false,false,0);

            storeOutput = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf),typeof (bool));

            nvOutput.Model = storeOutput;
            Gtk.CellRendererText collumnRenderer = new Gtk.CellRendererText();

            //nvOutput.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 2);
            nvOutput.AppendColumn ("", collumnRenderer, "text", 0);
            nvOutput.AppendColumn ("", collumnRenderer, "text", 1);
            nvOutput.Columns[0].FixedWidth = 200;
            nvOutput.Columns[1].Expand = true;

            //nvOutput.Columns[0].SetCellDataFunc(collumnRenderer, new Gtk.TreeCellDataFunc(RenderOutput));
            //nvOutput.Columns[1].SetCellDataFunc(collumnRenderer, new Gtk.TreeCellDataFunc(RenderOutput));

            this.Title = MainClass.Languages.Translate("publish_title" , project.ProjectName);

            if(project.ProjectUserSetting.CombinePublish == null || project.ProjectUserSetting.CombinePublish.Count==0){
                project.GeneratePublishCombination();
            }

            if(project.DevicesSettings == null || project.DevicesSettings.Count == 0)
                project.GenerateDevices();

            foreach (Rule rl in MainClass.Settings.Platform.Rules){

                if( (rl.Tag == -1 ) && !MainClass.Settings.ShowUnsupportedDevices) continue;
                if( (rl.Tag == -2 ) && !MainClass.Settings.ShowDebugDevices) continue;

                Device dvc = project.DevicesSettings.Find(x => x.TargetPlatformId == rl.Id);
                if (dvc == null) {
                    Console.WriteLine("generate device -{0}",rl.Id);
                    dvc = new Device();
                    dvc.TargetPlatformId = rl.Id;
                    dvc.PublishPropertisMask = project.GeneratePublishPropertisMask(rl.Id);
                    project.DevicesSettings.Add(dvc);
                }
            }

            project.Save();
            notebook = new Notebook();
            GenerateNotebookPages();

            this.vbox2.PackStart(notebook,true,true,0);//PackEnd

            VBox vbox1 = new VBox();

            chbOpenOutputDirectory = new CheckButton( MainClass.Languages.Translate("open_open_directory_after_publish"));
            chbOpenOutputDirectory.Toggled += new EventHandler(OnChbOpenOutputDirectoryToggled);

            chbIncludeAllResolution = new CheckButton( MainClass.Languages.Translate("include_all_resolution"));
            chbIncludeAllResolution.Active = project.IncludeAllResolution;
            chbIncludeAllResolution.Sensitive = false;
            chbIncludeAllResolution.Toggled+= delegate {
                project.IncludeAllResolution =chbIncludeAllResolution.Active;
            };

            vbox1.PackStart(chbIncludeAllResolution,false,false,0);
            vbox3.PackEnd(chbOpenOutputDirectory,false,false,0);

            chbDebugLog = new Gtk.CheckButton(MainClass.Languages.Translate("debug_log_publish"));
            chbDebugLog.Active = MainClass.Settings.LogPublish;
            chbDebugLog.Toggled+= delegate {
                MainClass.Settings.LogPublish =  chbDebugLog.Active;
            };

            vbox1.PackEnd(chbDebugLog,false,false,0);

            this.vbox2.PackEnd(vbox1,false,false,0);

            VBox hbox = new VBox();
            hbox.PackStart(chbSignApp,false,false,0);

            this.vbox2.PackEnd(hbox,false,false,0);

            this.ShowAll();

            int cpage = project.ProjectUserSetting.PublishPage;

            notebook.SwitchPage += delegate(object o, SwitchPageArgs args) {
                project.ProjectUserSetting.PublishPage = notebook.CurrentPage;

                NotebookLabel nl = (NotebookLabel)notebook.GetTabLabel(notebook.CurrentPageWidget);
                chbIncludeAllResolution.Sensitive = false;

                if(nl.Tag == null) return;

                Device d = project.DevicesSettings.Find(x=>(int)x.Devicetype==(int)nl.Tag);
                if(d!=null){
                    if(d.Includes != null){
                        if(d.Includes.Skin!=null){
                            if(!String.IsNullOrEmpty(d.Includes.Skin.Name))
                                chbIncludeAllResolution.Sensitive = true;
                        }
                    }
                }
            };

            chbOpenOutputDirectory.Active = MainClass.Settings.OpenOutputAfterPublish;

            notebook.CurrentPage =cpage;
            btnNext.GrabFocus();
        }
Ejemplo n.º 3
0
        public PublishDialog()
        {
            project  = MainClass.Workspace.ActualProject;

            this.TransientFor = MainClass.MainWindow;
            this.Build();

            btnResetMatrix.Label = MainClass.Languages.Translate("reset_matrix");
            this.Title = MainClass.Languages.Translate("publish_title" , project.ProjectName);

            if(project.ProjectUserSetting.CombinePublish == null || project.ProjectUserSetting.CombinePublish.Count==0){
                project.GeneratePublishCombination();
            }

            if(project.DevicesSettings == null || project.DevicesSettings.Count == 0)
                project.GenerateDevices();

            foreach (Rule rl in MainClass.Settings.Platform.Rules){

                if( (rl.Tag == -1 ) && !MainClass.Settings.ShowUnsupportedDevices) continue;
                if( (rl.Tag == -2 ) && !MainClass.Settings.ShowDebugDevices) continue;

                Device dvc = project.DevicesSettings.Find(x => x.TargetPlatformId == rl.Id);
                if (dvc == null) {
                    Console.WriteLine("generate device -{0}",rl.Id);
                    dvc = new Device();
                    dvc.TargetPlatformId = rl.Id;
                    dvc.PublishPropertisMask = project.GeneratePublishPropertisMask(rl.Id);
                    project.DevicesSettings.Add(dvc);
                }
            }
            project.Save();
            notebook = new Notebook();
            GenerateNotebookPages();

            this.vbox2.PackStart(notebook,true,true,0);//PackEnd

            VBox vbox1 = new VBox();

            chbOpenOutputDirectory = new CheckButton( MainClass.Languages.Translate("open_open_directory_after_publish"));
            chbOpenOutputDirectory.Toggled += new EventHandler(OnChbOpenOutputDirectoryToggled);

            chbIncludeAllResolution = new CheckButton( MainClass.Languages.Translate("include_all_resolution"));
            chbIncludeAllResolution.Active = project.IncludeAllResolution;
            chbIncludeAllResolution.Sensitive = false;
            chbIncludeAllResolution.Toggled+= delegate {
                project.IncludeAllResolution =chbIncludeAllResolution.Active;
            };

            vbox1.PackStart(chbIncludeAllResolution,false,false,0);
            vbox1.PackEnd(chbOpenOutputDirectory,false,false,0);

            chbDebugLog = new Gtk.CheckButton(MainClass.Languages.Translate("debug_log_publish"));
            //MainClass.Settings.LogPublish =false;
            chbDebugLog.Active = MainClass.Settings.LogPublish;
            chbDebugLog.Toggled+= delegate {
                MainClass.Settings.LogPublish =  chbDebugLog.Active;
            };

            vbox1.PackEnd(chbDebugLog,false,false,0);

            this.vbox2.PackEnd(vbox1,false,false,0);
            //this.vbox2.PackEnd(chbOpenOutputDirectory,false,false,0);//

            chbSignApp= new CheckButton( MainClass.Languages.Translate("sign_app"));
            chbSignApp.Toggled += new EventHandler(OnChbSignAppToggled);
            chbSignApp.Sensitive = true;//MainClass.Settings.SignAllow;
            //this.vbox2.PackEnd(chbSignApp,false,false,0);//

            VBox hbox = new VBox();
            hbox.PackStart(chbSignApp,false,false,0);

            this.vbox2.PackEnd(hbox,false,false,0);

            this.ShowAll();

            int cpage = project.ProjectUserSetting.PublishPage;

            notebook.SwitchPage += delegate(object o, SwitchPageArgs args) {
                project.ProjectUserSetting.PublishPage = notebook.CurrentPage;

                NotebookLabel nl = (NotebookLabel)notebook.GetTabLabel(notebook.CurrentPageWidget);
                chbIncludeAllResolution.Sensitive = false;

                if(nl.Tag == null) return;

                Device d = project.DevicesSettings.Find(x=>(int)x.Devicetype==(int)nl.Tag);
                if(d!=null){
                    if(d.Includes != null){
                        if(d.Includes.Skin!=null){
                            if(!String.IsNullOrEmpty(d.Includes.Skin.Name))
                                chbIncludeAllResolution.Sensitive = true;
                        }
                    }
                }
            };

            chbOpenOutputDirectory.Active = MainClass.Settings.OpenOutputAfterPublish;
            chbSignApp.Active = MainClass.Workspace.SignApp;

            notebook.CurrentPage =cpage;
            buttonOk.GrabFocus();
        }