Пример #1
0
        public SparkleAbout() : base("")
        {
            DefaultSize    = new Gdk.Size(600, 260);
            Resizable      = false;
            BorderWidth    = 0;
            IconName       = "folder-sparkleshare";
            WindowPosition = WindowPosition.Center;
            Title          = "About SparkleShare";
            AppPaintable   = true;

            string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine();

            Realize();
            Gdk.Pixbuf buf = new Gdk.Pixbuf(image_path);
            Gdk.Pixmap map, map2;
            buf.RenderPixmapAndMask(out map, out map2, 255);
            GdkWindow.SetBackPixmap(map, false);

            CreateAbout();


            DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Controller.WindowClosed();
                args.RetVal = true;
            };

            KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                if (args.Event.Key == Gdk.Key.Escape ||
                    (args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w))
                {
                    Controller.WindowClosed();
                }
            };

            Controller.HideWindowEvent += delegate {
                Application.Invoke(delegate {
                    HideAll();
                });
            };

            Controller.ShowWindowEvent += delegate {
                Application.Invoke(delegate {
                    ShowAll();
                    Present();
                });
            };

            Controller.UpdateLabelEvent += delegate(string text) {
                Application.Invoke(delegate {
                    this.updates.Markup = String.Format("<span font_size='small' fgcolor='#8cc4ff'>{0}</span>", text);
                    this.updates.ShowAll();
                });
            };
        }
Пример #2
0
        public SparkleAbout() : base("About SparkleShare")
        {
            SetWmclass("SparkleShare", "SparkleShare");

            IconName       = "sparkleshare";
            Resizable      = false;
            WindowPosition = WindowPosition.Center;

            SetSizeRequest(600, 260);


            DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Controller.WindowClosed();
                args.RetVal = true;
            };

            KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                if (args.Event.Key == Gdk.Key.Escape ||
                    (args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w))
                {
                    Controller.WindowClosed();
                }
            };

            Controller.HideWindowEvent += delegate {
                Application.Invoke(delegate { Hide(); });
            };

            Controller.ShowWindowEvent += delegate {
                Application.Invoke(delegate {
                    ShowAll();
                    Present();
                });
            };

            Controller.UpdateLabelEvent += delegate(string text) {
                Application.Invoke(delegate {
                    this.updates.Text = text;
                    this.updates.ShowAll();
                });
            };


            CreateAbout();
        }
Пример #3
0
        public SparkleAbout() : base()
        {
            using (var a = new NSAutoreleasePool())
            {
                SetFrame(new RectangleF(0, 0, 640, 281), true);
                Center();

                Delegate    = new SparkleAboutDelegate();
                StyleMask   = (NSWindowStyle.Closable | NSWindowStyle.Titled);
                Title       = "About SparkleShare";
                MaxSize     = new SizeF(640, 281);
                MinSize     = new SizeF(640, 281);
                HasShadow   = true;
                BackingType = NSBackingStore.Buffered;

                this.website_link       = new SparkleLink("Website", Controller.WebsiteLinkAddress);
                this.website_link.Frame = new RectangleF(new PointF(295, 25), this.website_link.Frame.Size);

                this.credits_link       = new SparkleLink("Credits", Controller.CreditsLinkAddress);
                this.credits_link.Frame = new RectangleF(
                    new PointF(this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
                    this.credits_link.Frame.Size);

                this.report_problem_link       = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress);
                this.report_problem_link.Frame = new RectangleF(
                    new PointF(this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
                    this.report_problem_link.Frame.Size);

                this.hidden_close_button = new NSButton()
                {
                    Frame = new RectangleF(0, 0, 0, 0),
                    KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                    KeyEquivalent             = "w"
                };

                this.hidden_close_button.Activated += delegate {
                    Controller.WindowClosed();
                };


                ContentView.AddSubview(this.hidden_close_button);

                CreateAbout();

                ContentView.AddSubview(this.website_link);
                ContentView.AddSubview(this.credits_link);
                ContentView.AddSubview(this.report_problem_link);
            }

            Controller.HideWindowEvent += delegate {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        PerformClose(this);
                    });
                }
            };

            Controller.ShowWindowEvent += delegate {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        OrderFrontRegardless();
                    });
                }
            };

            Controller.NewVersionEvent += delegate(string new_version) {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        this.updates_text_field.StringValue = "A newer version (" + new_version + ") is available!";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba(0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };

            Controller.VersionUpToDateEvent += delegate {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        this.updates_text_field.StringValue = "You are running the latest version.";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba(0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };

            Controller.CheckingForNewVersionEvent += delegate {
                using (var a = new NSAutoreleasePool())
                {
                    InvokeOnMainThread(delegate {
                        this.updates_text_field.StringValue = "Checking for updates...";
                        this.updates_text_field.TextColor   = NSColor.FromCalibratedRgba(0.45f, 0.62f, 0.81f, 1.0f);
                    });
                }
            };
        }
Пример #4
0
        public SparkleAbout() : base("")
        {
            DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Controller.WindowClosed();
                args.RetVal = true;
            };

            DefaultSize    = new Gdk.Size(600, 260);
            Resizable      = false;
            BorderWidth    = 0;
            IconName       = "folder-sparkleshare";
            WindowPosition = WindowPosition.Center;
            Title          = "About CmisSync";
            AppPaintable   = true;

            string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine();

            Realize();
            Gdk.Pixbuf buf = new Gdk.Pixbuf(image_path);
            Gdk.Pixmap map, map2;
            buf.RenderPixmapAndMask(out map, out map2, 255);
            GdkWindow.SetBackPixmap(map, false);

            CreateAbout();

            Controller.HideWindowEvent += delegate {
                Application.Invoke(delegate {
                    HideAll();
                });
            };

            Controller.ShowWindowEvent += delegate {
                Application.Invoke(delegate {
                    ShowAll();
                    Present();
                });
            };

            Controller.NewVersionEvent += delegate(string new_version) {
                Application.Invoke(delegate {
                    this.updates.Markup = String.Format("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                                                        string.Format("A newer version ({0}) is available!", new_version));

                    this.updates.ShowAll();
                });
            };

            Controller.VersionUpToDateEvent += delegate {
                Application.Invoke(delegate {
                    this.updates.Markup = String.Format("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                                                        "You are running the latest version.");

                    this.updates.ShowAll();
                });
            };

            Controller.CheckingForNewVersionEvent += delegate {
                Application.Invoke(delegate {
                    this.updates.Markup = String.Format("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                                                        "Checking for updates...");

                    this.updates.ShowAll();
                });
            };
        }
Пример #5
0
 private void Close(object sender, CancelEventArgs args)
 {
     Controller.WindowClosed();
     args.Cancel = true;
 }
Пример #6
0
        private void CreateAbout()
        {
            string about_image_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "Pixmaps", "about.png");

            this.about_image = new NSImage(about_image_path)
            {
                Size = new SizeF(640, 260)
            };

            this.about_image_view = new NSImageView()
            {
                Image = this.about_image,
                Frame = new RectangleF(0, 0, 640, 260)
            };

            this.version_text_field = new NSTextField()
            {
                StringValue     = "version " + Controller.RunningVersion,
                Frame           = new RectangleF(295, 140, 318, 22),
                BackgroundColor = NSColor.White,
                Bordered        = false,
                Editable        = false,
                DrawsBackground = false,
                TextColor       = NSColor.White,
                Font            = NSFontManager.SharedFontManager.FontWithFamily(
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
            };

            this.updates_text_field = new NSTextField()
            {
                StringValue     = "Checking for updates...",
                Frame           = new RectangleF(295, Frame.Height - 232, 318, 98),
                Bordered        = false,
                Editable        = false,
                DrawsBackground = false,
                TextColor       = NSColor.FromCalibratedRgba(1.0f, 1.0f, 1.0f, 0.5f),
                Font            = NSFontManager.SharedFontManager.FontWithFamily(
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11)
            };

            this.credits_text_field = new NSTextField()
            {
                StringValue = @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others." +
                              "\n" +
                              "\n" +
                              "SparkleShare is Open Source software. You are free to use, modify, and redistribute it " +
                              "under the GNU General Public License version 3 or later.",
                Frame           = new RectangleF(295, Frame.Height - 260, 318, 98),
                TextColor       = NSColor.White,
                DrawsBackground = false,
                Bordered        = false,
                Editable        = false,
                Font            = NSFontManager.SharedFontManager.FontWithFamily(
                    "Lucida Grande", NSFontTraitMask.Unbold, 0, 11),
            };

            this.website_link       = new SparkleLink("Website", Controller.WebsiteLinkAddress);
            this.website_link.Frame = new RectangleF(new PointF(295, 25), this.website_link.Frame.Size);

            this.credits_link       = new SparkleLink("Credits", Controller.CreditsLinkAddress);
            this.credits_link.Frame = new RectangleF(
                new PointF(this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
                this.credits_link.Frame.Size);

            this.report_problem_link       = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress);
            this.report_problem_link.Frame = new RectangleF(
                new PointF(this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
                this.report_problem_link.Frame.Size);

            this.debug_log_link       = new SparkleLink("Debug log", Controller.DebugLogLinkAddress);
            this.debug_log_link.Frame = new RectangleF(
                new PointF(this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25),
                this.debug_log_link.Frame.Size);

            this.hidden_close_button = new NSButton()
            {
                Frame = new RectangleF(0, 0, 0, 0),
                KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                KeyEquivalent             = "w"
            };


            this.hidden_close_button.Activated += delegate {
                Controller.WindowClosed();
            };


            ContentView.AddSubview(this.hidden_close_button);
            ContentView.AddSubview(this.about_image_view);
            ContentView.AddSubview(this.version_text_field);
            ContentView.AddSubview(this.updates_text_field);
            ContentView.AddSubview(this.credits_text_field);
            ContentView.AddSubview(this.website_link);
            ContentView.AddSubview(this.credits_link);
            ContentView.AddSubview(this.report_problem_link);
            ContentView.AddSubview(this.debug_log_link);
        }