예제 #1
0
        public WelcomeWidget(Builder builder, IntPtr handle) : base(handle)
        {
            builder.Autoconnect(this);
            FontDescription fontDescription2 = base.PangoContext.FontDescription;
            int             defsize          = fontDescription2.Size;

            fontDescription2.Size = 30520;
            var attr1 = new AttrList();

            attr1.Insert(new AttrFontDesc(fontDescription2));
            _label2.Attributes = attr1;

            FontDescription fontDescription = base.PangoContext.FontDescription;

            fontDescription.Size   = defsize * 4;
            fontDescription.Weight = Weight.Bold;
            this._label1.UseMarkup = true;
            var attr = new AttrList();

            attr.Insert(new AttrFontDesc(fontDescription));
            _label1.Attributes = attr;

            _button1.Clicked += ProjectButton_Activated;
            _button2.Clicked += ProjectButton_Activated;
            _button3.Clicked += ProjectButton_Activated;
            _button4.Clicked += ProjectButton_Activated;
            _button5.Clicked += Button5_Activated;
            _button6.Clicked += Button6_Activated;

            if (File.Exists(System.IO.Path.Combine(Program.ConfigPath, "RecentProjects")))
            {
                string text  = File.ReadAllText(System.IO.Path.Combine(Program.ConfigPath, "RecentProjects"));
                var    paths = text.Split('\n');

                foreach (var path in from p in paths where File.Exists(System.IO.Path.Combine(p, "project.json")) select p)
                {
                    if (_button4.Label == "Placeholder project")
                    {
                        _button4.Label = JObject.Parse(File.ReadAllText(System.IO.Path.Combine(path, "project.json")))["name"] + "\n" + path;
                    }
                    else if (_button3.Label == "Placeholder project")
                    {
                        _button3.Label = JObject.Parse(File.ReadAllText(System.IO.Path.Combine(path, "project.json")))["name"] + "\n" + path;
                    }
                    else if (_button2.Label == "Placeholder project")
                    {
                        _button2.Label = JObject.Parse(File.ReadAllText(System.IO.Path.Combine(path, "project.json")))["name"] + "\n" + path;
                    }
                    else if (_button1.Label == "Placeholder project")
                    {
                        _button1.Label = JObject.Parse(File.ReadAllText(System.IO.Path.Combine(path, "project.json")))["name"] + "\n" + path;
                    }
                }
            }

            if (_button1.Label == "Placeholder project")
            {
                _button1.Dispose();
            }

            if (_button2.Label == "Placeholder project")
            {
                _button2.Dispose();
            }

            if (_button3.Label == "Placeholder project")
            {
                _button3.Dispose();
            }

            if (_button4.Label == "Placeholder project")
            {
                _button4.Dispose();
            }
        }