Пример #1
0
        private void GenerateComboBoxSigning(ref Table table, string name, string label, string selectVal,int xPos,List<SettingValue> list)
        {
            xPos = xPos+3;
            Label lblApp = new Label(label);
            lblApp.Xalign = 1;
            lblApp.Yalign = 0.5F;
            lblApp.WidthRequest = 115;
            if(table.Name != "table1")
                lblApp.WidthRequest = 114;

            CellRendererText textRenderer = new CellRendererText();

            ComboBox cbe = new ComboBox();//(val);

            ListStore cbModel = new ListStore(typeof(string), typeof(string));

            cbe.PackStart(textRenderer, true);
            cbe.AddAttribute(textRenderer, "text", 0);

            cbe.Name = name;
            cbe.Model= cbModel;
            cbe.Active = 0;

            if(MainClass.Platform.IsMac){
                TreeIter ti = new TreeIter();

                foreach(SettingValue ds in list){// MainClass.Settings.InstallLocations){
                    if(ds.Value == selectVal){
                        ti = cbModel.AppendValues(ds.Display,ds.Value);
                        cbe.SetActiveIter(ti);
                    } else  cbModel.AppendValues(ds.Display,ds.Value);
                }
                if(cbe.Active <0)
                    cbe.Active =0;
            } else {
                cbe.Sensitive = false;
                if(!String.IsNullOrEmpty(selectVal)){
                    cbModel.AppendValues(selectVal,selectVal);
                    cbe.Active =0;
                } else {
                    Pango.FontDescription customFont =  Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
                    customFont.Weight = Pango.Weight.Bold;
                    cbe.ModifyFont(customFont);

                    cbModel.AppendValues("Please, don´t forget set the provisioning","");
                    cbe.Active =0;
                }
            }

            table.Attach(lblApp,0,1,(uint)(xPos-1),(uint)xPos,AttachOptions.Fill,AttachOptions.Shrink,0,0);
            table.Attach(cbe,1,2,(uint)(xPos-1),(uint)xPos,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Expand,0,0);
        }