GetImage() public static method

public static GetImage ( string name ) : Image
name string
return Image
Ejemplo n.º 1
0
        private void CreateNote()
        {
            ImageSource avatar = UserInterfaceHelpers.GetImageSource("user-icon-default");

            if (File.Exists(Controller.AvatarFilePath))
            {
                avatar = UserInterfaceHelpers.GetImage(Controller.AvatarFilePath);
            }

            this.user_image.ImageSource = avatar;
            this.Title = Controller.CurrentProject ?? "Add Note";
            this.user_name_text_block.Text  = SparkleShare.Controller.CurrentUser.Name;
            this.user_email_text_field.Text = SparkleShare.Controller.CurrentUser.Email;
            this.balloon_text_field.Text    = default_text;

            ElementHost.EnableModelessKeyboardInterop(this);
        }
Ejemplo n.º 2
0
        void CreateAbout()
        {
            CssProvider window_css_provider = new CssProvider();
            Image       image = UserInterfaceHelpers.GetImage("about.png");

            window_css_provider.LoadFromData("window, GtkWindow {" +
                                             "    background-image: url(\"/app/share/sparkleshare/pixmaps/about.png\");" +
                                             "    background-repeat: no-repeat;" +
                                             "    background-position: left bottom;" +
                                             "}");

            StyleContext.AddProvider(window_css_provider, 800);

            var layout_vertical = new VBox(false, 0);
            var links_layout    = new HBox(false, 16);

            CssProvider label_css_provider = new CssProvider();

            label_css_provider.LoadFromData("label { color: #fff; font-size: 14pt; background-color: rgba(0, 0, 0, 0); }");

            CssProvider label_highlight_css_provider = new CssProvider();

            label_highlight_css_provider.LoadFromData("label { color: #a8bbcf; font-size: 12pt; }");

            var version = new Label {
                Text   = "version " + Controller.RunningVersion,
                Xalign = 0, Xpad = 0
            };

            if (InstallationInfo.Directory.StartsWith("/app", StringComparison.InvariantCulture))
            {
                version.Text += " (Flatpak)";
            }

            updates = new Label("Checking for updates…")
            {
                Xalign = 0, Xpad = 0
            };

            var copyright = new Label {
                Markup = string.Format("Copyright © 2010–{0} Hylke Bons and others", DateTime.Now.Year),
                Xalign = 0, Xpad = 0
            };

            var license = new Label("SparkleShare is Open Source and you’re free to use,\n" +
                                    "change, and share it under the GNU GPLv3")
            {
                Xalign = 0, Xpad = 0
            };

            license.StyleContext.AddProvider(label_css_provider, 800);
            updates.StyleContext.AddProvider(label_highlight_css_provider, 800);
            version.StyleContext.AddProvider(label_css_provider, 800);
            copyright.StyleContext.AddProvider(label_css_provider, 800);

            var website_link        = new Link("Website", Controller.WebsiteLinkAddress);
            var credits_link        = new Link("Credits", Controller.CreditsLinkAddress);
            var report_problem_link = new Link("Report a problem", Controller.ReportProblemLinkAddress);
            var debug_log_link      = new Link("Debug log", Controller.DebugLogLinkAddress);

            layout_vertical.PackStart(new Label(""), true, true, 0);
            layout_vertical.PackStart(version, false, false, 0);
            layout_vertical.PackStart(updates, false, false, 0);
            layout_vertical.PackStart(copyright, false, false, 6);
            layout_vertical.PackStart(license, false, false, 6);
            layout_vertical.PackStart(links_layout, false, false, 16);

            links_layout.PackStart(website_link, false, false, 0);
            links_layout.PackStart(credits_link, false, false, 0);
            links_layout.PackStart(report_problem_link, false, false, 0);
            links_layout.PackStart(debug_log_link, false, false, 0);

            var layout_horizontal = new HBox(false, 0);

            layout_horizontal.PackStart(new Label(""), false, false, 149);
            layout_horizontal.PackStart(layout_vertical, false, false, 0);

            Add(layout_horizontal);
        }
Ejemplo n.º 3
0
        private void CreateNote()
        {
            Image user_image;

            if (File.Exists(Controller.AvatarFilePath))
            {
                user_image = new Image(Controller.AvatarFilePath);
            }
            else
            {
                user_image = UserInterfaceHelpers.GetImage("user-icon-default.png");
            }

            /* TODO: Style the entry neatly, multiple lines, and add placeholder text
             * string balloon_image_path = new string [] { UserInterface.AssetsPath, "pixmaps", "text-balloon.png" }.Combine ();
             * Image balloon_image = new Image (balloon_image_path);
             * CssProvider balloon_css_provider = new CssProvider ();
             *
             * balloon_css_provider.LoadFromData ("GtkEntry {" +
             *  "background-image: url('" + balloon_image_path + "');" +
             *  "background-repeat: no-repeat;" +
             *  "background-position: left top;" +
             *  "}");
             *
             * balloon.StyleContext.AddProvider (balloon_css_provider, 800);
             */

            var balloon_label = new Label("<b>Anything to add?</b>")
            {
                Xalign    = 0,
                UseMarkup = true
            };

            var balloon = new Entry {
                MaxLength = 144
            };


            var cancel_button = new Button("Cancel");
            var sync_button   = new Button("Sync")
            {
                CanDefault = true
            };

            sync_button.StyleContext.AddClass("suggested-action");

            cancel_button.Clicked += delegate { Controller.CancelClicked(); };
            sync_button.Clicked   += delegate { Controller.SyncClicked(balloon.Buffer.Text); };


            var layout_vertical   = new VBox(false, 16);
            var layout_horizontal = new HBox(false, 16);

            var buttons = new HBox {
                Homogeneous = false,
                Spacing     = 6
            };

            var user_label = new Label {
                Markup = "<b>" + SparkleShare.Controller.CurrentUser.Name + "</b>\n" +
                         "<span fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + SparkleShare.Controller.CurrentUser.Email +
                         "</span>"
            };


            layout_horizontal.PackStart(user_image, false, false, 0);
            layout_horizontal.PackStart(user_label, false, false, 0);

            buttons.PackStart(new Label(""), true, true, 0);
            buttons.PackStart(cancel_button, false, false, 0);
            buttons.PackStart(sync_button, false, false, 0);

            layout_vertical.PackStart(layout_horizontal, false, false, 0);
            layout_vertical.PackStart(balloon_label, false, false, 0);
            layout_vertical.PackStart(balloon, false, false, 0);
            layout_vertical.PackStart(buttons, false, false, 0);

            Default = sync_button;

            Add(layout_vertical);
        }