Esempio n. 1
0
        public void UpdateContent(string html)
        {
            string pixmaps_path = IO.Path.Combine(SparkleUI.AssetsPath, "pixmaps");
            string icons_path = new string [] { SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status" }.Combine();

            html = html.Replace("<!-- $body-font-size -->", (double)(Style.FontDescription.Size / 1024 + 3) + "px");
            html = html.Replace("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
            html = html.Replace("<!-- $a-color -->", "#0085cf");
            html = html.Replace("<!-- $a-hover-color -->", "#009ff8");
            html = html.Replace("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
            html = html.Replace("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Normal)));
            html = html.Replace("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex(new TreeView().Style.Base(StateType.Normal)));
            html = html.Replace("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex(Style.Background(StateType.Normal)));
            html = html.Replace("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
            html = html.Replace("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
            html = html.Replace("<!-- $small-font-size -->", "85%");
            html = html.Replace("<!-- $pixmaps-path -->", pixmaps_path);
            html = html.Replace("<!-- $document-added-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-added.png"));
            html = html.Replace("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-edited.png"));
            html = html.Replace("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-deleted.png"));
            html = html.Replace("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-moved.png"));

            this.spinner.Stop();

            this.web_view.NavigationRequested -= WebViewNavigationRequested;
            this.web_view.LoadHtmlString(html, "file://");
            this.web_view.NavigationRequested += WebViewNavigationRequested;

            this.content_wrapper.Remove(this.content_wrapper.Child);
            this.content_wrapper.Add(this.scrolled_window);
            this.content_wrapper.ShowAll();
        }
Esempio n. 2
0
        public SparkleAbout()
        {
            Title      = "About SparkleShare";
            ResizeMode = ResizeMode.NoResize;
            Height     = 288;
            Width      = 640;
            Icon       = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");

            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            Closing += Close;

            CreateAbout();

            Controller.ShowWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    Show();
                    Activate();
                    BringIntoView();
                });
            };

            Controller.HideWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    Hide();
                });
            };

            Controller.UpdateLabelEvent += delegate(string text) {
                Dispatcher.BeginInvoke((Action) delegate {
                    this.updates.Content = text;
                    this.updates.UpdateLayout();
                });
            };
        }
Esempio n. 3
0
        public SparkleInfobar(string icon_name, string title, string text)
        {
            Window window = new Window(WindowType.Popup)
            {
                Name = "gtk-tooltip"
            };

            window.EnsureStyle();

            Style = window.Style;

            Label label = new Label()
            {
                Markup = "<b>" + title + "</b>\n" + text
            };

            HBox hbox = new HBox(false, 12)
            {
                BorderWidth = 12
            };

            hbox.PackStart(new Image(SparkleUIHelpers.GetIcon(icon_name, 24)),
                           false, false, 0);

            hbox.PackStart(label, false, false, 0);

            Add(hbox);
        }
Esempio n. 4
0
        // The state when there's nothing going on
        private void SetNormalState(bool error)
        {
            Animation.Stop();

            if (SparkleShare.Controller.Folders.Count == 0)
            {
                StateText = _("Welcome to SparkleShare!");
                Application.Invoke(delegate {
                    Pixbuf = AnimationFrames [0];
                });
            }
            else
            {
                if (error)
                {
                    StateText = _("Not everything is synced");
                    Application.Invoke(delegate {
                        Pixbuf = SparkleUIHelpers.GetIcon("sparkleshare-syncing-error", 24);
                    });
                }
                else
                {
                    StateText = _("Up to date") + "  (" + SparkleShare.Controller.FolderSize + ")";
                    Application.Invoke(delegate {
                        Pixbuf = AnimationFrames [0];
                    });
                }
            }
        }
Esempio n. 5
0
        private void CreateAbout()
        {
            Image image = new Image()
            {
                Width  = 640,
                Height = 260
            };

            image.Source = SparkleUIHelpers.GetImageSource("about");


            Label version = new Label()
            {
                Content    = "version " + Controller.RunningVersion,
                FontSize   = 11,
                Foreground = new SolidColorBrush(Colors.White)
            };

            this.updates = new Label()
            {
                Content    = "Checking for updates...",
                FontSize   = 11,
                Foreground = new SolidColorBrush(Color.FromRgb(135, 178, 227))
            };

            TextBlock credits = new TextBlock()
            {
                FontSize   = 11,
                Foreground = new SolidColorBrush(Colors.White),
                Text       = "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.",
                TextWrapping = TextWrapping.Wrap,
                Width        = 318
            };


            Canvas canvas = new Canvas();

            canvas.Children.Add(image);
            Canvas.SetLeft(image, 0);
            Canvas.SetTop(image, 0);

            canvas.Children.Add(version);
            Canvas.SetLeft(version, 289);
            Canvas.SetTop(version, 92);

            canvas.Children.Add(this.updates);
            Canvas.SetLeft(this.updates, 289);
            Canvas.SetTop(this.updates, 109);

            canvas.Children.Add(credits);
            Canvas.SetLeft(credits, 294);
            Canvas.SetTop(credits, 142);

            Content = canvas;
        }
        public SparkleSpinner(int size) : base()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            Width  = size;
            Height = size;

            int          current_frame    = 0;
            BitmapSource spinner_gallery  = SparkleUIHelpers.GetImageSource("process-working-22");
            int          frames_in_width  = spinner_gallery.PixelWidth / size;
            int          frames_in_height = spinner_gallery.PixelHeight / size;
            int          frame_count      = (frames_in_width * frames_in_height) - 1;

            Image [] frames = new Image [frame_count];

            int i = 0;

            for (int y = 0; y < frames_in_height; y++)
            {
                for (int x = 0; x < frames_in_width; x++)
                {
                    if (!(y == 0 && x == 0))
                    {
                        CroppedBitmap crop = new CroppedBitmap(spinner_gallery,
                                                               new Int32Rect(size * x, size * y, size, size));

                        frames [i]        = new Image();
                        frames [i].Source = crop;
                        i++;
                    }
                }
            }

            this.timer = new Timer()
            {
                Interval = 400 / frame_count
            };

            this.timer.Elapsed += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    if (current_frame < frame_count - 1)
                    {
                        current_frame++;
                    }
                    else
                    {
                        current_frame = 0;
                    }

                    Source = frames [current_frame].Source;
                });
            };
        }
Esempio n. 7
0
 private void CreateAnimationFrames()
 {
     this.animation_frames = new Gdk.Pixbuf [] {
         SparkleUIHelpers.GetIcon("process-syncing-i", 24),
         SparkleUIHelpers.GetIcon("process-syncing-ii", 24),
         SparkleUIHelpers.GetIcon("process-syncing-iii", 24),
         SparkleUIHelpers.GetIcon("process-syncing-iiii", 24),
         SparkleUIHelpers.GetIcon("process-syncing-iiiii", 24)
     };
 }
Esempio n. 8
0
        private void CreateAnimationFrames()
        {
            this.animation_frames = new Gdk.Pixbuf [5];
            Gdk.Pixbuf frames_pixbuf = SparkleUIHelpers.GetIcon("process-syncing-sparkleshare", 24);

            for (int i = 0; i < this.animation_frames.Length; i++)
            {
                animation_frames [i] = new Gdk.Pixbuf(frames_pixbuf, (i * 24), 0, 24, 24);
            }
        }
Esempio n. 9
0
        public SparkleSetupWindow()
        {
            Title      = "SparkleShare Setup";
            Width      = 640;
            Height     = 440;
            ResizeMode = ResizeMode.NoResize;
            Background = new SolidColorBrush(Colors.WhiteSmoke);
            Icon       = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");

            TaskbarItemInfo = new TaskbarItemInfo()
            {
                Description = "SparkleShare"
            };

            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            Content = ContentCanvas;

            Closing += Close;

            this.bar = new Rectangle()
            {
                Width  = Width,
                Height = 40,
                Fill   = new SolidColorBrush(Color.FromRgb(240, 240, 240))
            };

            this.line = new Rectangle()
            {
                Width  = Width,
                Height = 1,
                Fill   = new SolidColorBrush(Color.FromRgb(223, 223, 223))
            };


            this.side_splash = new Image()
            {
                Width  = 150,
                Height = 482
            };

            this.side_splash.Source = SparkleUIHelpers.GetImageSource("side-splash");


            ContentCanvas.Children.Add(this.bar);
            Canvas.SetRight(bar, 0);
            Canvas.SetBottom(bar, 0);

            ContentCanvas.Children.Add(this.line);
            Canvas.SetRight(this.line, 0);
            Canvas.SetBottom(this.line, 40);

            ContentCanvas.Children.Add(this.side_splash);
            Canvas.SetLeft(this.side_splash, 0);
            Canvas.SetBottom(this.side_splash, 0);
        }
Esempio n. 10
0
        private void CreateAnimationFrames()
        {
            this.animation_frames = new Drawing.Bitmap [] {
                SparkleUIHelpers.GetBitmap("process-syncing-i"),
                SparkleUIHelpers.GetBitmap("process-syncing-ii"),
                SparkleUIHelpers.GetBitmap("process-syncing-iii"),
                SparkleUIHelpers.GetBitmap("process-syncing-iiii"),
                SparkleUIHelpers.GetBitmap("process-syncing-iiiii")
            };

            this.error_icon = SparkleUIHelpers.GetBitmap("process-syncing-error");
        }
        public SparkleSetupWindow() : base("SparkleShare Setup")
        {
            SetWmclass("SparkleShare", "SparkleShare");

            IconName       = "sparkleshare";
            Resizable      = false;
            WindowPosition = WindowPosition.Center;
            Deletable      = false;
            TypeHint       = Gdk.WindowTypeHint.Dialog;


            SetSizeRequest(680, 400);

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

            Gdk.Color color = SparkleUIHelpers.RGBAToColor(StyleContext.GetColor(StateFlags.Insensitive));
            SecondaryTextColor = SparkleUIHelpers.ColorToHex(color);

            color = MixColors(
                SparkleUIHelpers.RGBAToColor(new TreeView().StyleContext.GetColor(StateFlags.Selected)),
                SparkleUIHelpers.RGBAToColor(new TreeView().StyleContext.GetBackgroundColor(StateFlags.Selected)),
                0.39);

            SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex(color);

            HBox layout_horizontal = new HBox(false, 0);

            VBox layout_vertical = new VBox(false, 0);

            this.content_area = new EventBox();
            this.option_area  = new EventBox();

            this.buttons = CreateButtonBox();

            HBox layout_actions = new HBox(false, 48);

            layout_actions.PackStart(this.option_area, true, true, 0);
            layout_actions.PackStart(this.buttons, false, false, 0);

            layout_vertical.PackStart(this.content_area, true, true, 0);
            layout_vertical.PackStart(layout_actions, false, false, 15);

            Image side_splash = SparkleUIHelpers.GetImage("side-splash.png");

            side_splash.Yalign = 1;

            layout_horizontal.PackStart(side_splash, false, false, 0);
            layout_horizontal.PackStart(layout_vertical, true, true, 30);

            base.Add(layout_horizontal);
        }
Esempio n. 12
0
        public SparkleNote()
        {
            InitializeComponent();

            Background         = new SolidColorBrush(Color.FromRgb(240, 240, 240));
            AllowsTransparency = false;
            Icon = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");
            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            Closing += this.OnClosing;

            Controller.ShowWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action)(() => {
                    Show();
                    Activate();
                    CreateNote();
                    BringIntoView();
                }));
            };

            Controller.HideWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action)(() => {
                    Hide();
                    this.balloon_text_field.Clear();
                }));
            };

            this.cancel_button.Click += delegate {
                Dispatcher.BeginInvoke((Action)(() => {
                    Controller.CancelClicked();
                }));
            };

            this.sync_button.Click += delegate {
                Dispatcher.BeginInvoke((Action)(() => {
                    string note = this.balloon_text_field.Text;

                    if (note.Equals(default_text, StringComparison.InvariantCultureIgnoreCase))
                    {
                        note = String.Empty;
                    }

                    Controller.SyncClicked(note);
                }));
            };

            this.balloon_text_field.GotFocus  += OnTextBoxGotFocus;
            this.balloon_text_field.LostFocus += OnTextBoxLostFocus;

            CreateNote();
        }
Esempio n. 13
0
        public void UpdateContent(string html)
        {
            Thread thread = new Thread(new ThreadStart(delegate {
                if (html == null)
                {
                    html = Controller.HTML;
                }

                if (html == null)
                {
                    return;
                }

                html = html.Replace("<!-- $body-font-size -->", (double)(Style.FontDescription.Size / 1024 + 3) + "px");
                html = html.Replace("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
                html = html.Replace("<!-- $a-color -->", "#0085cf");
                html = html.Replace("<!-- $a-hover-color -->", "#009ff8");
                html = html.Replace("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
                html = html.Replace("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Normal)));
                html = html.Replace("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex(new TreeView().Style.Base(StateType.Normal)));
                html = html.Replace("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex(Style.Background(StateType.Normal)));
                html = html.Replace("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
                html = html.Replace("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
                html = html.Replace("<!-- $no-buddy-icon-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "32x32", "status", "avatar-default.png" }.Combine());
                html = html.Replace("<!-- $document-added-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "12x12", "status", "document-added.png" }.Combine());
                html = html.Replace("<!-- $document-edited-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "12x12", "status", "document-edited.png" }.Combine());
                html = html.Replace("<!-- $document-deleted-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "12x12", "status", "document-deleted.png" }.Combine());
                html = html.Replace("<!-- $document-moved-background-image -->", "file://" +
                                    new string [] { SparkleUI.AssetsPath, "icons",
                                                    "hicolor", "12x12", "status", "document-moved.png" }.Combine());

                Application.Invoke(delegate {
                    this.spinner.Stop();
                    this.web_view.LoadString(html, null, null, "file:///");
                    this.content_wrapper.Remove(this.content_wrapper.Child);
                    this.content_wrapper.Add(this.scrolled_window);
                    this.content_wrapper.ShowAll();
                });
            }));

            thread.Start();
        }
Esempio n. 14
0
        public SparkleAbout()
        {
            Title      = "About SparkleShare";
            ResizeMode = ResizeMode.NoResize;
            Height     = 288;
            Width      = 640;
            Icon       = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");

            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            Closing += Close;

            CreateAbout();

            Controller.ShowWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    Show();
                    Activate();
                    BringIntoView();
                });
            };

            Controller.HideWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    Hide();
                });
            };

            Controller.NewVersionEvent += delegate(string new_version) {
                Dispatcher.BeginInvoke((Action) delegate {
                    this.updates.Content = "A newer version (" + new_version + ") is available!";
                    this.updates.UpdateLayout();
                });
            };

            Controller.VersionUpToDateEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    this.updates.Content = "You are running the latest version.";
                    this.updates.UpdateLayout();
                });
            };

            Controller.CheckingForNewVersionEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    this.updates.Content = "Checking for updates...";
                    this.updates.UpdateLayout();
                });
            };
        }
Esempio n. 15
0
        public SparkleSpinner(int size) : base()
        {
            Width  = size;
            Height = size;

            BitmapSource spinner_gallery =
                SparkleUIHelpers.GetImageSource("process-working-22");

            int frames_in_width  = spinner_gallery.PixelWidth / size;
            int frames_in_height = spinner_gallery.PixelHeight / size;

            this.num_steps = (frames_in_width * frames_in_height) - 1;
            this.images    = new Image [this.num_steps];

            int i = 0;

            for (int y = 0; y < frames_in_height; y++)
            {
                for (int x = 0; x < frames_in_width; x++)
                {
                    if (!(y == 0 && x == 0))
                    {
                        CroppedBitmap crop = new CroppedBitmap(
                            spinner_gallery,
                            new Int32Rect(size * x, size * y, size, size)
                            );

                        this.images [i]        = new Image();
                        this.images [i].Source = crop;
                        i++;
                    }
                }
            }

            this.timer = new Timer()
            {
                Interval = 400 / this.num_steps
            };

            this.timer.Elapsed += delegate {
                Dispatcher.Invoke((Action) delegate {
                    NextImage();
                });
            };

            Start();
        }
Esempio n. 16
0
        public SparkleSetupWindow() : base("")
        {
            Title          = Catalog.GetString("SparkleShare Setup");
            BorderWidth    = 0;
            IconName       = "folder-sparkleshare";
            Resizable      = false;
            WindowPosition = WindowPosition.Center;
            Deletable      = false;

            SetSizeRequest(680, 440);

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

            HBox = new HBox(false, 6);

            VBox = new VBox(false, 0);

            Wrapper = new VBox(false, 0)
            {
                BorderWidth = 30
            };

            Buttons = CreateButtonBox();

            VBox.PackStart(Wrapper, true, true, 0);
            VBox.PackStart(Buttons, false, false, 0);

            EventBox box = new EventBox();

            Gdk.Color bg_color = new Gdk.Color();
            Gdk.Color.Parse("#000", ref bg_color);
            box.ModifyBg(StateType.Normal, bg_color);

            Image side_splash = SparkleUIHelpers.GetImage("side-splash.png");

            side_splash.Yalign = 1;

            box.Add(side_splash);

            HBox.PackStart(box, false, false, 0);
            HBox.PackStart(VBox, true, true, 0);

            base.Add(HBox);
        }
Esempio n. 17
0
        public SparkleUI()
        {
            this.application = new Gtk.Application("org.sparkleshare.sparkleshare", 0);

            this.application.Register(null);
            this.application.Activated += ApplicationActivatedDelegate;

            Gdk.Color color = SparkleUIHelpers.RGBAToColor(new Label().StyleContext.GetColor(StateFlags.Insensitive));
            SecondaryTextColor = SparkleUIHelpers.ColorToHex(color);

            color = SparkleUIHelpers.MixColors(
                SparkleUIHelpers.RGBAToColor(new TreeView().StyleContext.GetColor(StateFlags.Selected)),
                SparkleUIHelpers.RGBAToColor(new TreeView().StyleContext.GetBackgroundColor(StateFlags.Selected)),
                0.39);

            SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex(color);
        }
Esempio n. 18
0
        private void CreateNote()
        {
            ImageSource avatar = SparkleUIHelpers.GetImageSource("user-icon-default");

            if (File.Exists(Controller.AvatarFilePath))
            {
                avatar = SparkleUIHelpers.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);
        }
Esempio n. 19
0
        public void UpdateContent(string html)
        {
            string pixmaps_path = new string [] { SparkleUI.AssetsPath, "pixmaps" }.Combine();
            string icons_path = new string [] { SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status" }.Combine();

            html = html.Replace("<!-- $a-hover-color -->", "#009ff8");
            html = html.Replace("<!-- $a-color -->", "#0085cf");

            html = html.Replace("<!-- $body-font-family -->", StyleContext.GetFont(StateFlags.Normal).Family);
            html = html.Replace("<!-- $body-font-size -->", (double)(StyleContext.GetFont(StateFlags.Normal).Size / 1024 + 3) + "px");
            html = html.Replace("<!-- $body-color -->", SparkleUIHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Normal)));
            html = html.Replace("<!-- $body-background-color -->",
                                SparkleUIHelpers.RGBAToHex(new TreeView().StyleContext.GetBackgroundColor(StateFlags.Normal)));

            html = html.Replace("<!-- $day-entry-header-font-size -->", (StyleContext.GetFont(StateFlags.Normal).Size / 1024 + 3) + "px");
            html = html.Replace("<!-- $day-entry-header-background-color -->",
                                SparkleUIHelpers.RGBAToHex(StyleContext.GetBackgroundColor(StateFlags.Normal)));

            html = html.Replace("<!-- $secondary-font-color -->", SparkleUIHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Insensitive)));

            html = html.Replace("<!-- $small-color -->", SparkleUIHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Insensitive)));
            html = html.Replace("<!-- $small-font-size -->", "90%");

            html = html.Replace("<!-- $pixmaps-path -->", pixmaps_path);
            html = html.Replace("<!-- $document-added-background-image -->", "file://" + new string [] { icons_path, "document-added.png" }.Combine());
            html = html.Replace("<!-- $document-edited-background-image -->", "file://" + new string [] { icons_path, "document-edited.png" }.Combine());
            html = html.Replace("<!-- $document-deleted-background-image -->", "file://" + new string [] { icons_path, "document-deleted.png" }.Combine());
            html = html.Replace("<!-- $document-moved-background-image -->", "file://" + new string [] { icons_path, "document-moved.png" }.Combine());

            this.spinner.Stop();
            this.scrolled_window.Remove(this.web_view);
            this.web_view.Dispose();

            this.web_view = new WebView()
            {
                Editable = false
            };
            this.web_view.LoadString(html, "text/html", "UTF-8", "file://");
            this.web_view.NavigationRequested += WebViewNavigationRequested;
            this.scrolled_window.Add(this.web_view);

            this.content_wrapper.Remove(this.content_wrapper.Child);
            this.content_wrapper.Add(this.scrolled_window);
            this.scrolled_window.ShowAll();
        }
Esempio n. 20
0
        public SparkleSpinner(int size) : base()
        {
            int current_frame = 0;

            Gdk.Pixbuf spinner_gallery  = SparkleUIHelpers.GetIcon("process-working", size);
            int        frames_in_width  = spinner_gallery.Width / size;
            int        frames_in_height = spinner_gallery.Height / size;
            int        frame_count      = (frames_in_width * frames_in_height) - 1;

            Gdk.Pixbuf [] frames = new Gdk.Pixbuf [frame_count];

            int i = 0;

            for (int y = 0; y < frames_in_height; y++)
            {
                for (int x = 0; x < frames_in_width; x++)
                {
                    if (!(y == 0 && x == 0))
                    {
                        frames [i] = new Gdk.Pixbuf(spinner_gallery, x * size, y * size, size, size);
                        i++;
                    }
                }
            }

            timer = new Timer()
            {
                Interval = 600 / frame_count
            };

            timer.Elapsed += delegate {
                if (current_frame < frame_count - 1)
                {
                    current_frame++;
                }
                else
                {
                    current_frame = 0;
                }

                Application.Invoke(delegate {
                    Pixbuf = frames [current_frame];
                });
            };
        }
Esempio n. 21
0
        private void WriteOutImages()
        {
            string tmp_path     = SparkleLib.SparkleConfig.DefaultConfig.TmpPath;
            string pixmaps_path = Path.Combine(tmp_path, "Pixmaps");

            if (!Directory.Exists(pixmaps_path))
            {
                Directory.CreateDirectory(pixmaps_path);

                File.SetAttributes(tmp_path,
                                   File.GetAttributes(tmp_path) | FileAttributes.Hidden);
            }

            char [] letters = new char [] { 'a', 'b', 'c',
                                            'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k' };

            foreach (char letter in letters)
            {
                BitmapSource image     = SparkleUIHelpers.GetImageSource("avatar-" + letter);
                string       file_path = Path.Combine(pixmaps_path, "avatar-" + letter + ".png");

                using (FileStream stream = new FileStream(file_path, FileMode.Create))
                {
                    BitmapEncoder encoder = new PngBitmapEncoder();
                    encoder.Frames.Add(BitmapFrame.Create(image));
                    encoder.Save(stream);
                }
            }

            string [] actions = new string [] { "added",
                                                "deleted", "edited", "moved" };

            foreach (string action in actions)
            {
                BitmapSource image     = SparkleUIHelpers.GetImageSource("document-" + action + "-12");
                string       file_path = Path.Combine(pixmaps_path, "document-" + action + "-12.png");

                using (FileStream stream = new FileStream(file_path, FileMode.Create))
                {
                    BitmapEncoder encoder = new PngBitmapEncoder();
                    encoder.Frames.Add(BitmapFrame.Create(image));
                    encoder.Save(stream);
                }
            }
        }
Esempio n. 22
0
        private void GenerateHTML()
        {
            HTML = SparkleShare.Controller.GetHTMLLog(System.IO.Path.GetFileName(LocalPath));

            HTML = HTML.Replace("<!-- $body-font-size -->", (double)(Style.FontDescription.Size / 1024 + 3) + "px");
            HTML = HTML.Replace("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
            HTML = HTML.Replace("<!-- $a-color -->", "#0085cf");
            HTML = HTML.Replace("<!-- $a-hover-color -->", "#009ff8");
            HTML = HTML.Replace("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
            HTML = HTML.Replace("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Normal)));
            HTML = HTML.Replace("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex(new TreeView().Style.Base(StateType.Normal)));
            HTML = HTML.Replace("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex(Style.Background(StateType.Normal)));
            HTML = HTML.Replace("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
            HTML = HTML.Replace("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive)));
            HTML = HTML.Replace("<!-- $no-buddy-icon-background-image -->", "file://" +
                                SparkleHelpers.CombineMore(Defines.PREFIX, "share", "sparkleshare", "icons",
                                                           "hicolor", "32x32", "status", "avatar-default.png"));
        }
Esempio n. 23
0
        public SparkleSetupWindow() : base("SparkleShare Setup")
        {
            SetWmclass("SparkleShare", "SparkleShare");

            IconName       = "sparkleshare";
            Resizable      = false;
            WindowPosition = WindowPosition.Center;
            Deletable      = false;
            TypeHint       = Gdk.WindowTypeHint.Dialog;


            SetSizeRequest(680, 400);

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

            HBox layout_horizontal = new HBox(false, 0);

            VBox layout_vertical = new VBox(false, 0);

            this.content_area = new EventBox();
            this.option_area  = new EventBox();

            this.buttons = CreateButtonBox();

            HBox layout_actions = new HBox(false, 48);

            layout_actions.PackStart(this.option_area, true, true, 0);
            layout_actions.PackStart(this.buttons, false, false, 0);

            layout_vertical.PackStart(this.content_area, true, true, 0);
            layout_vertical.PackStart(layout_actions, false, false, 15);

            Image side_splash = SparkleUIHelpers.GetImage("side-splash.png");

            side_splash.Yalign = 1;

            layout_horizontal.PackStart(side_splash, false, false, 0);
            layout_horizontal.PackStart(layout_vertical, true, true, 30);

            base.Add(layout_horizontal);
        }
Esempio n. 24
0
        public SparkleSpinner(int size) : base()
        {
            Size = size;

            CycleDuration = 600;
            CurrentStep   = 0;

            Gdk.Pixbuf spinner_gallery = SparkleUIHelpers.GetIcon("process-working", Size);

            int frames_in_width  = spinner_gallery.Width / Size;
            int frames_in_height = spinner_gallery.Height / Size;

            NumSteps = frames_in_width * frames_in_height;
            Images   = new Gdk.Pixbuf [NumSteps - 1];

            int i = 0;

            for (int y = 0; y < frames_in_height; y++)
            {
                for (int x = 0; x < frames_in_width; x++)
                {
                    if (!(y == 0 && x == 0))
                    {
                        Images [i] = new Gdk.Pixbuf(spinner_gallery, x * Size, y * Size, Size, Size);
                        i++;
                    }
                }
            }

            Timer = new Timer()
            {
                Interval = CycleDuration / NumSteps
            };

            Timer.Elapsed += delegate {
                NextImage();
            };

            Start();
        }
Esempio n. 25
0
        private void WriteOutImages()
        {
            string tmp_path     = SparkleLib.SparkleConfig.DefaultConfig.TmpPath;
            string pixmaps_path = Path.Combine(tmp_path, "Images".SHA1());

            if (!Directory.Exists(pixmaps_path))
            {
                Directory.CreateDirectory(pixmaps_path);

                File.SetAttributes(tmp_path,
                                   File.GetAttributes(tmp_path) | FileAttributes.Hidden);
            }

            BitmapSource image     = SparkleUIHelpers.GetImageSource("user-icon-default");
            string       file_path = Path.Combine(pixmaps_path, "user-icon-default.png");

            using (FileStream stream = new FileStream(file_path, FileMode.Create))
            {
                BitmapEncoder encoder = new PngBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create(image));
                encoder.Save(stream);
            }

            string [] actions = new string [] { "added", "deleted", "edited", "moved" };

            foreach (string action in actions)
            {
                image     = SparkleUIHelpers.GetImageSource("document-" + action + "-12");
                file_path = Path.Combine(pixmaps_path, "document-" + action + "-12.png");

                using (FileStream stream = new FileStream(file_path, FileMode.Create))
                {
                    BitmapEncoder encoder = new PngBitmapEncoder();
                    encoder.Frames.Add(BitmapFrame.Create(image));
                    encoder.Save(stream);
                }
            }
        }
Esempio n. 26
0
        public void CreateMenu()
        {
            this.menu       = new Menu();
            this.state_item = new MenuItem(Controller.StateText)
            {
                Sensitive = false
            };

            ImageMenuItem folder_item = new SparkleMenuItem("SparkleShare");

            folder_item.Image = new Image(SparkleUIHelpers.GetIcon("sparkleshare", 16));

            this.menu.Add(this.state_item);
            this.menu.Add(new SeparatorMenuItem());
            this.menu.Add(folder_item);


            this.state_menu_items = new SparkleMenuItem [Controller.Projects.Length];

            if (Controller.Projects.Length > 0)
            {
                int i = 0;
                foreach (ProjectInfo project in Controller.Projects)
                {
                    SparkleMenuItem item = new SparkleMenuItem(project.Name);

                    Gdk.Pixbuf folder_icon;
                    folder_icon = IconTheme.Default.LoadIcon("folder", 16, IconLookupFlags.GenericFallback);

                    item.Submenu = new Menu();

                    this.state_menu_items [i] = new MenuItem(project.StatusMessage)
                    {
                        Sensitive = false
                    };

                    (item.Submenu as Menu).Add(this.state_menu_items [i]);
                    (item.Submenu as Menu).Add(new SeparatorMenuItem());

                    if (project.IsPaused)
                    {
                        MenuItem resume_item;

                        if (project.UnsyncedChangesInfo.Count > 0)
                        {
                            string icons_path = new string [] { SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status" }.Combine();

                            foreach (KeyValuePair <string, string> pair in project.UnsyncedChangesInfo)
                            {
                                (item.Submenu as Menu).Add(new MenuItem(pair.Key)
                                {
                                    Image = new Image()
                                    {
                                        File = new string [] { icons_path, pair.Value.Replace("-12", "") }.Combine()
                                    },
                                    Sensitive = false
                                });
                            }

                            if (!string.IsNullOrEmpty(project.MoreUnsyncedChanges))
                            {
                                (item.Submenu as Menu).Add(new MenuItem(MoreUnsyncedChanges)
                                {
                                    Sensitive = false
                                });
                            }

                            (item.Submenu as Menu).Add(new SeparatorMenuItem());
                            resume_item = new MenuItem("Sync and Resume…");
                        }
                        else
                        {
                            resume_item = new MenuItem("Resume");
                        }

                        resume_item.Activated += Controller.ResumeDelegate(project.Name);
                        (item.Submenu as Menu).Add(resume_item);
                    }
                    else
                    {
                        if (Controller.Projects [i].HasError)
                        {
                            folder_icon = IconTheme.Default.LoadIcon("dialog-warning", 16, IconLookupFlags.GenericFallback);

                            MenuItem try_again_item = new MenuItem("Try Again");
                            try_again_item.Activated += Controller.TryAgainDelegate(project.Name);
                            (item.Submenu as Menu).Add(try_again_item);
                        }
                        else
                        {
                            MenuItem pause_item = new MenuItem("Pause");
                            pause_item.Activated += Controller.PauseDelegate(project.Name);
                            (item.Submenu as Menu).Add(pause_item);
                        }
                    }

                    (item.Child as Label).UseUnderline = false;
                    item.Image = new Image(folder_icon);
                    this.menu.Add(item);

                    i++;
                }
                ;
            }

            this.recent_events_item           = new MenuItem("Recent Changes…");
            this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled;
            this.quit_item = new MenuItem("Quit")
            {
                Sensitive = Controller.QuitItemEnabled
            };
            MenuItem add_item = new MenuItem("Add Hosted Project…");

            #if HAVE_APP_INDICATOR
            MenuItem notify_item;

            if (Program.Controller.NotificationsEnabled)
            {
                notify_item = new MenuItem("Turn Notifications Off");
            }
            else
            {
                notify_item = new MenuItem("Turn Notifications On");
            }

            notify_item.Activated += delegate {
                Program.Controller.ToggleNotifications();

                Application.Invoke(delegate {
                    if (Program.Controller.NotificationsEnabled)
                    {
                        (notify_item.Child as Label).Text = "Turn Notifications Off";
                    }
                    else
                    {
                        (notify_item.Child as Label).Text = "Turn Notifications On";
                    }
                });
            };
            #endif

            MenuItem link_code_item = new MenuItem("Client ID");

            if (Controller.LinkCodeItemEnabled)
            {
                link_code_item.Submenu = new Menu();

                string   link_code = Program.Controller.CurrentUser.PublicKey.Substring(0, 20) + "...";
                MenuItem code_item = new MenuItem(link_code)
                {
                    Sensitive = false
                };

                MenuItem copy_item = new MenuItem("Copy to Clipboard");
                copy_item.Activated += delegate { Controller.CopyToClipboardClicked(); };

                (link_code_item.Submenu as Menu).Add(code_item);
                (link_code_item.Submenu as Menu).Add(new SeparatorMenuItem());
                (link_code_item.Submenu as Menu).Add(copy_item);
            }

            MenuItem about_item = new MenuItem("About SparkleShare");

            about_item.Activated += delegate { Controller.AboutClicked(); };
            add_item.Activated   += delegate { Controller.AddHostedProjectClicked(); };
            this.recent_events_item.Activated += delegate { Controller.RecentEventsClicked(); };
            this.quit_item.Activated          += delegate { Controller.QuitClicked(); };

            folder_item.Submenu = new Menu();
            (folder_item.Submenu as Menu).Add(this.recent_events_item);
            (folder_item.Submenu as Menu).Add(add_item);
            #if HAVE_APP_INDICATOR
            (folder_item.Submenu as Menu).Add(new SeparatorMenuItem());
            (folder_item.Submenu as Menu).Add(notify_item);
            #endif
            (folder_item.Submenu as Menu).Add(new SeparatorMenuItem());
            (folder_item.Submenu as Menu).Add(link_code_item);
            (folder_item.Submenu as Menu).Add(new SeparatorMenuItem());
            (folder_item.Submenu as Menu).Add(about_item);

            this.menu.Add(new SeparatorMenuItem());
            this.menu.Add(this.quit_item);
            this.menu.ShowAll();

            #if HAVE_APP_INDICATOR
            this.indicator.Menu = this.menu;
            #endif
        }
Esempio n. 27
0
        public void CreateMenu()
        {
            this.context_menu = new ContextMenu();

            this.state_item = new SparkleMenuItem()
            {
                Header    = Controller.StateText,
                IsEnabled = false
            };

            this.notify_icon.HeaderText = "SparkleShare\n" + Controller.StateText;

            Image folder_image = new Image()
            {
                Source = SparkleUIHelpers.GetImageSource("sparkleshare-folder"),
                Width  = 16,
                Height = 16
            };

            SparkleMenuItem folder_item = new SparkleMenuItem()
            {
                Header = "SparkleShare",
                Icon   = folder_image
            };

            folder_item.Click += delegate {
                Controller.SparkleShareClicked();
            };

            SparkleMenuItem add_item = new SparkleMenuItem()
            {
                Header = "Add hosted project…"
            };

            add_item.Click += delegate {
                Controller.AddHostedProjectClicked();
            };

            this.log_item = new SparkleMenuItem()
            {
                Header    = "Recent changes…",
                IsEnabled = Controller.OpenRecentEventsItemEnabled
            };

            this.log_item.Click += delegate {
                Controller.OpenRecentEventsClicked();
            };

            SparkleMenuItem notify_item = new SparkleMenuItem()
            {
                Header = "Notifications"
            };

            CheckBox notify_check_box = new CheckBox()
            {
                Margin    = new Thickness(6, 0, 0, 0),
                IsChecked = (Controller.Folders.Length > 0 && Program.Controller.NotificationsEnabled)
            };

            notify_item.Icon = notify_check_box;

            notify_check_box.Click += delegate {
                this.context_menu.IsOpen = false;
                Program.Controller.ToggleNotifications();
                notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
            };

            notify_item.Click += delegate {
                Program.Controller.ToggleNotifications();
                notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
            };

            SparkleMenuItem about_item = new SparkleMenuItem()
            {
                Header = "About SparkleShare"
            };

            about_item.Click += delegate {
                Controller.AboutClicked();
            };

            this.exit_item = new SparkleMenuItem()
            {
                Header = "Exit"
            };

            this.exit_item.Click += delegate {
                this.notify_icon.Dispose();
                Controller.QuitClicked();
            };


            this.context_menu.Items.Add(this.state_item);
            this.context_menu.Items.Add(new Separator());
            this.context_menu.Items.Add(folder_item);

            if (Controller.Folders.Length > 0)
            {
                foreach (string folder_name in Controller.Folders)
                {
                    SparkleMenuItem subfolder_item = new SparkleMenuItem()
                    {
                        Header = folder_name
                    };

                    subfolder_item.Click += OpenFolderDelegate(folder_name);

                    Image subfolder_image = new Image()
                    {
                        Source = SparkleUIHelpers.GetImageSource("folder"),
                        Width  = 16,
                        Height = 16
                    };

                    if (Program.Controller.UnsyncedFolders.Contains(folder_name))
                    {
                        subfolder_item.Icon = new Image()
                        {
                            Source = (BitmapSource)Imaging.CreateBitmapSourceFromHIcon(
                                System.Drawing.SystemIcons.Exclamation.Handle,
                                Int32Rect.Empty,
                                BitmapSizeOptions.FromWidthAndHeight(16, 16)
                                )
                        };
                    }
                    else
                    {
                        subfolder_item.Icon = subfolder_image;
                    }

                    this.context_menu.Items.Add(subfolder_item);
                }

                SparkleMenuItem more_item = new SparkleMenuItem()
                {
                    Header = "More projects"
                };

                foreach (string folder_name in Controller.OverflowFolders)
                {
                    SparkleMenuItem subfolder_item = new SparkleMenuItem()
                    {
                        Header = folder_name
                    };

                    subfolder_item.Click += OpenFolderDelegate(folder_name);

                    Image subfolder_image = new Image()
                    {
                        Source = SparkleUIHelpers.GetImageSource("folder"),
                        Width  = 16,
                        Height = 16
                    };

                    if (Program.Controller.UnsyncedFolders.Contains(folder_name))
                    {
                        subfolder_item.Icon = new Image()
                        {
                            Source = (BitmapSource)Imaging.CreateBitmapSourceFromHIcon(
                                System.Drawing.SystemIcons.Exclamation.Handle,
                                Int32Rect.Empty,
                                BitmapSizeOptions.FromWidthAndHeight(16, 16)
                                )
                        };
                    }
                    else
                    {
                        subfolder_item.Icon = subfolder_image;
                    }

                    more_item.Items.Add(subfolder_item);
                }

                if (more_item.Items.Count > 0)
                {
                    this.context_menu.Items.Add(new Separator());
                    this.context_menu.Items.Add(more_item);
                }
            }

            this.context_menu.Items.Add(new Separator());
            this.context_menu.Items.Add(add_item);
            this.context_menu.Items.Add(this.log_item);
            this.context_menu.Items.Add(new Separator());
            this.context_menu.Items.Add(notify_item);
            this.context_menu.Items.Add(new Separator());
            this.context_menu.Items.Add(about_item);
            this.context_menu.Items.Add(new Separator());
            this.context_menu.Items.Add(this.exit_item);

            this.notify_icon.ContextMenu = this.context_menu;
        }
Esempio n. 28
0
        public SparkleSetup()
        {
            Controller.ShowWindowEvent += delegate {
                Dispatcher.Invoke((Action) delegate {
                    Show();
                    Activate();
                    BringIntoView();
                });
            };

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

            Controller.ChangePageEvent += delegate(PageType type, string [] warnings) {
                Dispatcher.Invoke((Action) delegate {
                    Reset();

                    switch (type)
                    {
                    case PageType.Setup: {
                        Header      = "Welcome to SparkleShare!";
                        Description = "Before we get started, what's your name and email?\n" +
                                      "Don't worry, this information will only be visible to team members.";


                        TextBlock name_label = new TextBlock()
                        {
                            Text          = "Full Name:",
                            Width         = 150,
                            TextAlignment = TextAlignment.Right,
                            FontWeight    = FontWeights.Bold
                        };

                        TextBox name_box = new TextBox()
                        {
                            Text  = Controller.GuessedUserName,
                            Width = 175
                        };


                        TextBlock email_label = new TextBlock()
                        {
                            Text          = "Email:",
                            Width         = 150,
                            TextAlignment = TextAlignment.Right,
                            FontWeight    = FontWeights.Bold
                        };

                        TextBox email_box = new TextBox()
                        {
                            Width = 175,
                            Text  = Controller.GuessedUserEmail
                        };



                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        Button continue_button = new Button()
                        {
                            Content   = "Continue",
                            IsEnabled = false
                        };


                        ContentCanvas.Children.Add(name_label);
                        Canvas.SetLeft(name_label, 180);
                        Canvas.SetTop(name_label, 200 + 3);

                        ContentCanvas.Children.Add(name_box);
                        Canvas.SetLeft(name_box, 340);
                        Canvas.SetTop(name_box, 200);

                        ContentCanvas.Children.Add(email_label);
                        Canvas.SetLeft(email_label, 180);
                        Canvas.SetTop(email_label, 230 + 3);

                        ContentCanvas.Children.Add(email_box);
                        Canvas.SetLeft(email_box, 340);
                        Canvas.SetTop(email_box, 230);

                        Buttons.Add(continue_button);
                        Buttons.Add(cancel_button);

                        name_box.Focus();
                        name_box.Select(name_box.Text.Length, 0);

                        Controller.UpdateSetupContinueButtonEvent += delegate(bool enabled) {
                            Dispatcher.Invoke((Action) delegate {
                                    continue_button.IsEnabled = enabled;
                                });
                        };

                        name_box.TextChanged += delegate {
                            Controller.CheckSetupPage(name_box.Text, email_box.Text);
                        };

                        email_box.TextChanged += delegate {
                            Controller.CheckSetupPage(name_box.Text, email_box.Text);
                        };

                        cancel_button.Click += delegate {
                            Dispatcher.Invoke((Action) delegate {
                                    SparkleUI.StatusIcon.Dispose();
                                    Controller.SetupPageCancelled();
                                });
                        };

                        continue_button.Click += delegate {
                            Controller.SetupPageCompleted(name_box.Text, email_box.Text);
                        };

                        Controller.CheckSetupPage(name_box.Text, email_box.Text);

                        break;
                    }

                    case PageType.Invite: {
                        Header      = "You've received an invite!";
                        Description = "Do you want to add this project to SparkleShare?";


                        TextBlock address_label = new TextBlock()
                        {
                            Text          = "Address:",
                            Width         = 150,
                            TextAlignment = TextAlignment.Right
                        };

                        TextBlock address_value = new TextBlock()
                        {
                            Text       = Controller.PendingInvite.Address,
                            Width      = 175,
                            FontWeight = FontWeights.Bold
                        };


                        TextBlock path_label = new TextBlock()
                        {
                            Text          = "Remote Path:",
                            Width         = 150,
                            TextAlignment = TextAlignment.Right
                        };

                        TextBlock path_value = new TextBlock()
                        {
                            Width      = 175,
                            Text       = Controller.PendingInvite.RemotePath,
                            FontWeight = FontWeights.Bold
                        };



                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        Button add_button = new Button()
                        {
                            Content = "Add"
                        };


                        ContentCanvas.Children.Add(address_label);
                        Canvas.SetLeft(address_label, 180);
                        Canvas.SetTop(address_label, 200);

                        ContentCanvas.Children.Add(address_value);
                        Canvas.SetLeft(address_value, 340);
                        Canvas.SetTop(address_value, 200);

                        ContentCanvas.Children.Add(path_label);
                        Canvas.SetLeft(path_label, 180);
                        Canvas.SetTop(path_label, 225);

                        ContentCanvas.Children.Add(path_value);
                        Canvas.SetLeft(path_value, 340);
                        Canvas.SetTop(path_value, 225);

                        Buttons.Add(add_button);
                        Buttons.Add(cancel_button);


                        cancel_button.Click += delegate {
                            Controller.PageCancelled();
                        };

                        add_button.Click += delegate {
                            Controller.InvitePageCompleted();
                        };

                        break;
                    }

                    case PageType.Add: {
                        Header = "Where's your project hosted?";


                        ListView list_view = new ListView()
                        {
                            Width         = 419,
                            Height        = 195,
                            SelectionMode = SelectionMode.Single
                        };

                        GridView grid_view = new GridView()
                        {
                            AllowsColumnReorder = false
                        };

                        grid_view.Columns.Add(new GridViewColumn());

                        string xaml =
                            "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"" +
                            "  xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">" +
                            "  <Grid>" +
                            "    <StackPanel Orientation=\"Horizontal\">" +
                            "      <Image Margin=\"5,0,0,0\" Source=\"{Binding Image}\" Height=\"24\" Width=\"24\"/>" +
                            "      <StackPanel>" +
                            "        <TextBlock Padding=\"10,4,0,0\" FontWeight=\"Bold\" Text=\"{Binding Name}\">" +
                            "        </TextBlock>" +
                            "        <TextBlock Padding=\"10,0,0,4\" Opacity=\"0.5\" Text=\"{Binding Description}\">" +
                            "        </TextBlock>" +
                            "      </StackPanel>" +
                            "    </StackPanel>" +
                            "  </Grid>" +
                            "</DataTemplate>";

                        grid_view.Columns [0].CellTemplate = (DataTemplate)XamlReader.Parse(xaml);

                        Style header_style = new Style(typeof(GridViewColumnHeader));
                        header_style.Setters.Add(new Setter(GridViewColumnHeader.VisibilityProperty, Visibility.Collapsed));
                        grid_view.ColumnHeaderContainerStyle = header_style;

                        foreach (SparklePlugin plugin in Controller.Plugins)
                        {
                            // FIXME: images are blurry
                            BitmapFrame image = BitmapFrame.Create(
                                new Uri(plugin.ImagePath)
                                );

                            list_view.Items.Add(
                                new {
                                    Name        = plugin.Name,
                                    Description = plugin.Description,
                                    Image       = image
                                }
                                );
                        }

                        list_view.View          = grid_view;
                        list_view.SelectedIndex = Controller.SelectedPluginIndex;

                        TextBlock address_label = new TextBlock()
                        {
                            Text       = "Address:",
                            FontWeight = FontWeights.Bold
                        };

                        TextBox address_box = new TextBox()
                        {
                            Width     = 200,
                            Text      = Controller.PreviousAddress,
                            IsEnabled = (Controller.SelectedPlugin.Address == null)
                        };

                        TextBlock address_help_label = new TextBlock()
                        {
                            Text       = Controller.SelectedPlugin.AddressExample,
                            FontSize   = 11,
                            Foreground = new SolidColorBrush(Color.FromRgb(128, 128, 128))
                        };

                        TextBlock path_label = new TextBlock()
                        {
                            Text       = "Remote Path:",
                            FontWeight = FontWeights.Bold,
                            Width      = 200
                        };

                        TextBox path_box = new TextBox()
                        {
                            Width     = 200,
                            Text      = Controller.PreviousPath,
                            IsEnabled = (Controller.SelectedPlugin.Path == null)
                        };

                        TextBlock path_help_label = new TextBlock()
                        {
                            Text       = Controller.SelectedPlugin.PathExample,
                            FontSize   = 11,
                            Width      = 200,
                            Foreground = new SolidColorBrush(Color.FromRgb(128, 128, 128))
                        };

                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        Button add_button = new Button()
                        {
                            Content = "Add"
                        };

                        CheckBox history_check_box = new CheckBox()
                        {
                            Content   = "Fetch prior revisions",
                            IsChecked = Controller.FetchPriorHistory
                        };

                        history_check_box.Click += delegate {
                            Controller.HistoryItemChanged(history_check_box.IsChecked.Value);
                        };

                        ContentCanvas.Children.Add(history_check_box);
                        Canvas.SetLeft(history_check_box, 185);
                        Canvas.SetBottom(history_check_box, 12);

                        ContentCanvas.Children.Add(list_view);
                        Canvas.SetTop(list_view, 70);
                        Canvas.SetLeft(list_view, 185);

                        ContentCanvas.Children.Add(address_label);
                        Canvas.SetTop(address_label, 285);
                        Canvas.SetLeft(address_label, 185);

                        ContentCanvas.Children.Add(address_box);
                        Canvas.SetTop(address_box, 305);
                        Canvas.SetLeft(address_box, 185);

                        ContentCanvas.Children.Add(address_help_label);
                        Canvas.SetTop(address_help_label, 330);
                        Canvas.SetLeft(address_help_label, 185);

                        ContentCanvas.Children.Add(path_label);
                        Canvas.SetTop(path_label, 285);
                        Canvas.SetRight(path_label, 30);

                        ContentCanvas.Children.Add(path_box);
                        Canvas.SetTop(path_box, 305);
                        Canvas.SetRight(path_box, 30);

                        ContentCanvas.Children.Add(path_help_label);
                        Canvas.SetTop(path_help_label, 330);
                        Canvas.SetRight(path_help_label, 30);

                        TaskbarItemInfo.ProgressValue = 0.0;
                        TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;

                        Buttons.Add(add_button);
                        Buttons.Add(cancel_button);

                        address_box.Focus();
                        address_box.Select(address_box.Text.Length, 0);


                        Controller.ChangeAddressFieldEvent += delegate(string text,
                                                                       string example_text, FieldState state) {
                            Dispatcher.Invoke((Action) delegate {
                                    address_box.Text        = text;
                                    address_box.IsEnabled   = (state == FieldState.Enabled);
                                    address_help_label.Text = example_text;
                                });
                        };

                        Controller.ChangePathFieldEvent += delegate(string text,
                                                                    string example_text, FieldState state) {
                            Dispatcher.Invoke((Action) delegate {
                                    path_box.Text        = text;
                                    path_box.IsEnabled   = (state == FieldState.Enabled);
                                    path_help_label.Text = example_text;
                                });
                        };

                        Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                            Dispatcher.Invoke((Action) delegate {
                                    add_button.IsEnabled = button_enabled;
                                });
                        };

                        list_view.SelectionChanged += delegate {
                            Controller.SelectedPluginChanged(list_view.SelectedIndex);
                        };

                        list_view.KeyDown += delegate {
                            Controller.SelectedPluginChanged(list_view.SelectedIndex);
                        };

                        Controller.CheckAddPage(address_box.Text, path_box.Text, list_view.SelectedIndex);

                        address_box.TextChanged += delegate {
                            Controller.CheckAddPage(address_box.Text, path_box.Text, list_view.SelectedIndex);
                        };

                        path_box.TextChanged += delegate {
                            Controller.CheckAddPage(address_box.Text, path_box.Text, list_view.SelectedIndex);
                        };

                        cancel_button.Click += delegate {
                            Controller.PageCancelled();
                        };

                        add_button.Click += delegate {
                            Controller.AddPageCompleted(address_box.Text, path_box.Text);
                        };

                        break;
                    }


                    case PageType.Syncing: {
                        Header      = "Adding project ‘" + Controller.SyncingFolder + "’…";
                        Description = "This may either take a short or a long time depending on the project's size.";

                        Button finish_button = new Button()
                        {
                            Content   = "Finish",
                            IsEnabled = false
                        };

                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        ProgressBar progress_bar = new ProgressBar()
                        {
                            Width  = 414,
                            Height = 15,
                            Value  = Controller.ProgressBarPercentage
                        };


                        ContentCanvas.Children.Add(progress_bar);
                        Canvas.SetLeft(progress_bar, 185);
                        Canvas.SetTop(progress_bar, 150);

                        TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal;

                        Buttons.Add(finish_button);
                        Buttons.Add(cancel_button);


                        Controller.UpdateProgressBarEvent += delegate(double percentage) {
                            Dispatcher.Invoke((Action) delegate {
                                    progress_bar.Value            = percentage;
                                    TaskbarItemInfo.ProgressValue = percentage / 100;
                                });
                        };

                        cancel_button.Click += delegate {
                            Controller.SyncingCancelled();
                        };

                        break;
                    }


                    case PageType.Error: {
                        Header      = "Something went wrong…";
                        Description = "Please check the following:";


                        TextBlock help_block = new TextBlock()
                        {
                            TextWrapping = TextWrapping.Wrap,
                            Width        = 310
                        };

                        help_block.Inlines.Add("Is the host online?\n\n");
                        help_block.Inlines.Add(new Bold(new Run(Controller.PreviousUrl)));
                        help_block.Inlines.Add(" is the address we've compiled. Does this look alright?\n\n");
                        help_block.Inlines.Add("The host needs to know who you are. Did you upload the key that's in your SparkleShare folder?");

                        TextBlock bullets_block = new TextBlock()
                        {
                            Text = "•\n\n•\n\n\n•"
                        };


                        Button cancel_button = new Button()
                        {
                            Content = "Cancel"
                        };

                        Button try_again_button = new Button()
                        {
                            Content = "Try again…"
                        };



                        ContentCanvas.Children.Add(bullets_block);
                        Canvas.SetLeft(bullets_block, 195);
                        Canvas.SetTop(bullets_block, 100);

                        ContentCanvas.Children.Add(help_block);
                        Canvas.SetLeft(help_block, 210);
                        Canvas.SetTop(help_block, 100);

                        TaskbarItemInfo.ProgressValue = 1.0;
                        TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Error;

                        Buttons.Add(try_again_button);
                        Buttons.Add(cancel_button);


                        cancel_button.Click += delegate {
                            Controller.PageCancelled();
                        };

                        try_again_button.Click += delegate {
                            Controller.ErrorPageCompleted();
                        };

                        break;
                    }

                    case PageType.Finished: {
                        Header      = "Your shared project is ready!";
                        Description = "You can find the files in your SparkleShare folder.";


                        Button finish_button = new Button()
                        {
                            Content = "Finish"
                        };

                        Button open_folder_button = new Button()
                        {
                            Content = string.Format("Open {0}", Path.GetFileName(Controller.PreviousPath))
                        };

                        if (warnings.Length > 0)
                        {
                            Image warning_image = new Image()
                            {
                                Source = Imaging.CreateBitmapSourceFromHIcon(Drawing.SystemIcons.Information.Handle,
                                                                             Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())
                            };

                            TextBlock warning_block = new TextBlock()
                            {
                                Text         = warnings [0],
                                Width        = 310,
                                TextWrapping = TextWrapping.Wrap
                            };

                            ContentCanvas.Children.Add(warning_image);
                            Canvas.SetLeft(warning_image, 193);
                            Canvas.SetTop(warning_image, 100);

                            ContentCanvas.Children.Add(warning_block);
                            Canvas.SetLeft(warning_block, 240);
                            Canvas.SetTop(warning_block, 100);
                        }

                        TaskbarItemInfo.ProgressValue = 0.0;
                        TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;

                        Buttons.Add(finish_button);
                        Buttons.Add(open_folder_button);


                        finish_button.Click += delegate {
                            Controller.FinishPageCompleted();
                        };

                        open_folder_button.Click += delegate {
                            Controller.OpenFolderClicked();
                        };


                        SystemSounds.Exclamation.Play();

                        break;
                    }

                    case PageType.Tutorial: {
                        switch (Controller.TutorialPageNumber)
                        {
                        case 1: {
                            Header      = "What's happening next?";
                            Description = "SparkleShare creates a special folder on your computer " +
                                          "that will keep track of your projects.";


                            WPF.Image slide_image = new WPF.Image()
                            {
                                Width  = 350,
                                Height = 200
                            };

                            slide_image.Source = SparkleUIHelpers.GetImageSource("tutorial-slide-1-windows");

                            Button skip_tutorial_button = new Button()
                            {
                                Content = "Skip tutorial"
                            };

                            Button continue_button = new Button()
                            {
                                Content = "Continue"
                            };


                            ContentCanvas.Children.Add(slide_image);
                            Canvas.SetLeft(slide_image, 215);
                            Canvas.SetTop(slide_image, 130);

                            Buttons.Add(continue_button);
                            Buttons.Add(skip_tutorial_button);


                            skip_tutorial_button.Click += delegate {
                                Controller.TutorialSkipped();
                            };

                            continue_button.Click += delegate {
                                Controller.TutorialPageCompleted();
                            };

                            break;
                        }

                        case 2: {
                            Header      = "Sharing files with others";
                            Description = "All files added to your project folders are synced automatically with " +
                                          "the host and your team members.";


                            Button continue_button = new Button()
                            {
                                Content = "Continue"
                            };

                            WPF.Image slide_image = new WPF.Image()
                            {
                                Width  = 350,
                                Height = 200
                            };

                            slide_image.Source = SparkleUIHelpers.GetImageSource("tutorial-slide-2-windows");


                            ContentCanvas.Children.Add(slide_image);
                            Canvas.SetLeft(slide_image, 215);
                            Canvas.SetTop(slide_image, 130);

                            Buttons.Add(continue_button);


                            continue_button.Click += delegate {
                                Controller.TutorialPageCompleted();
                            };

                            break;
                        }

                        case 3: {
                            Header      = "The status icon is here to help";
                            Description = "It shows the syncing progress, provides easy access to " +
                                          "your projects and lets you view recent changes.";


                            Button continue_button = new Button()
                            {
                                Content = "Continue"
                            };

                            WPF.Image slide_image = new WPF.Image()
                            {
                                Width  = 350,
                                Height = 200
                            };

                            slide_image.Source = SparkleUIHelpers.GetImageSource("tutorial-slide-3-windows");


                            ContentCanvas.Children.Add(slide_image);
                            Canvas.SetLeft(slide_image, 215);
                            Canvas.SetTop(slide_image, 130);

                            Buttons.Add(continue_button);


                            continue_button.Click += delegate {
                                Controller.TutorialPageCompleted();
                            };

                            break;
                        }

                        case 4: {
                            Header      = "Adding projects to SparkleShare";
                            Description = "You can do this through the status icon menu, or by clicking " +
                                          "magic buttons on webpages that look like this:";


                            Button finish_button = new Button()
                            {
                                Content = "Finish"
                            };

                            WPF.Image slide_image = new WPF.Image()
                            {
                                Width  = 350,
                                Height = 64
                            };

                            slide_image.Source = SparkleUIHelpers.GetImageSource("tutorial-slide-4");

                            CheckBox check_box = new CheckBox()
                            {
                                Content   = "Add SparkleShare to startup items",
                                IsChecked = true
                            };


                            ContentCanvas.Children.Add(slide_image);
                            Canvas.SetLeft(slide_image, 215);
                            Canvas.SetTop(slide_image, 130);

                            ContentCanvas.Children.Add(check_box);
                            Canvas.SetLeft(check_box, 185);
                            Canvas.SetBottom(check_box, 12);

                            Buttons.Add(finish_button);


                            check_box.Click += delegate {
                                Controller.StartupItemChanged(check_box.IsChecked.Value);
                            };

                            finish_button.Click += delegate {
                                Controller.TutorialPageCompleted();
                            };

                            break;
                        }
                        }
                        break;
                    }
                    }

                    ShowAll();
                });
            };
        }
Esempio n. 29
0
        public void CreateMenu()
        {
            this.context_menu = new ContextMenu();

            this.state_item = new SparkleMenuItem {
                Header    = Controller.StateText,
                IsEnabled = false
            };

            Image folder_image = new Image {
                Source = SparkleUIHelpers.GetImageSource("sparkleshare-folder"),
                Width  = 16,
                Height = 16
            };

            SparkleMenuItem folder_item = new SparkleMenuItem {
                Header = "SparkleShare",
                Icon   = folder_image
            };

            SparkleMenuItem add_item = new SparkleMenuItem {
                Header = "Add hosted project…"
            };

            this.log_item = new SparkleMenuItem {
                Header    = "Recent changes…",
                IsEnabled = Controller.RecentEventsItemEnabled
            };

            SparkleMenuItem link_code_item = new SparkleMenuItem {
                Header = "Client ID"
            };

            if (Controller.LinkCodeItemEnabled)
            {
                SparkleMenuItem code_item = new SparkleMenuItem {
                    Header = Program.Controller.CurrentUser.PublicKey.Substring(0, 20) + "..."
                };

                SparkleMenuItem copy_item = new SparkleMenuItem {
                    Header = "Copy to Clipboard"
                };
                copy_item.Click += delegate {
                    Controller.CopyToClipboardClicked();
                };

                link_code_item.Items.Add(code_item);
                link_code_item.Items.Add(new Separator());
                link_code_item.Items.Add(copy_item);
            }

            CheckBox notify_check_box = new CheckBox {
                Margin    = new Thickness(6, 0, 0, 0),
                IsChecked = Program.Controller.NotificationsEnabled
            };

            SparkleMenuItem notify_item = new SparkleMenuItem {
                Header = "Notifications",
                Icon   = notify_check_box
            };

            SparkleMenuItem about_item = new SparkleMenuItem {
                Header = "About SparkleShare"
            };

            this.exit_item = new SparkleMenuItem {
                Header = "Exit"
            };


            add_item.Click += delegate {
                Controller.AddHostedProjectClicked();
            };
            this.log_item.Click += delegate {
                Controller.RecentEventsClicked();
            };
            about_item.Click += delegate {
                Controller.AboutClicked();
            };

            notify_check_box.Click += delegate {
                this.context_menu.IsOpen = false;
                Program.Controller.ToggleNotifications();
                notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
            };

            notify_item.Click += delegate {
                Program.Controller.ToggleNotifications();
                notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
            };

            this.exit_item.Click += delegate {
                this.notify_icon.Dispose();
                Controller.QuitClicked();
            };


            this.context_menu.Items.Add(this.state_item);
            this.context_menu.Items.Add(new Separator());
            this.context_menu.Items.Add(folder_item);

            state_menu_items = new SparkleMenuItem[Controller.Projects.Length];

            if (Controller.Projects.Length > 0)
            {
                int i = 0;
                foreach (ProjectInfo project in Controller.Projects)
                {
                    SparkleMenuItem subfolder_item = new SparkleMenuItem {
                        Header = project.Name.Replace("_", "__"),
                        Icon   = new Image {
                            Source = SparkleUIHelpers.GetImageSource("folder"),
                            Width  = 16,
                            Height = 16
                        }
                    };

                    state_menu_items[i] = new SparkleMenuItem {
                        Header    = project.StatusMessage,
                        IsEnabled = false
                    };

                    subfolder_item.Items.Add(state_menu_items[i]);
                    subfolder_item.Items.Add(new Separator());

                    SparkleMenuItem open_item = new SparkleMenuItem {
                        Header = "Open folder",
                        Icon   = new Image
                        {
                            Source = SparkleUIHelpers.GetImageSource("folder"),
                            Width  = 16,
                            Height = 16
                        }
                    };

                    open_item.Click += new RoutedEventHandler(Controller.OpenFolderDelegate(project.Name));
                    subfolder_item.Items.Add(open_item);
                    subfolder_item.Items.Add(new Separator());

                    if (project.IsPaused)
                    {
                        SparkleMenuItem resume_item;

                        if (project.UnsyncedChangesInfo.Count > 0)
                        {
                            foreach (KeyValuePair <string, string> pair in project.UnsyncedChangesInfo)
                            {
                                subfolder_item.Items.Add(new SparkleMenuItem {
                                    Header = pair.Key,
                                    // TODO image
                                    IsEnabled = false
                                });
                            }

                            if (!string.IsNullOrEmpty(project.MoreUnsyncedChanges))
                            {
                                subfolder_item.Items.Add(new SparkleMenuItem {
                                    Header    = project.MoreUnsyncedChanges,
                                    IsEnabled = false
                                });
                            }

                            subfolder_item.Items.Add(new Separator());
                            resume_item = new SparkleMenuItem {
                                Header = "Sync and Resume…"
                            };
                        }
                        else
                        {
                            resume_item = new SparkleMenuItem {
                                Header = "Resume"
                            };
                        }

                        resume_item.Click += (sender, e) => Controller.ResumeDelegate(project.Name)(sender, e);
                        subfolder_item.Items.Add(resume_item);
                    }
                    else
                    {
                        if (Controller.Projects[i].HasError)
                        {
                            subfolder_item.Icon = new Image {
                                Source = Imaging.CreateBitmapSourceFromHIcon(
                                    Drawing.SystemIcons.Exclamation.Handle, Int32Rect.Empty,
                                    BitmapSizeOptions.FromWidthAndHeight(16, 16))
                            };

                            SparkleMenuItem try_again_item = new SparkleMenuItem {
                                Header = "Try Again"
                            };
                            try_again_item.Click += (sender, e) => Controller.TryAgainDelegate(project.Name)(sender, e);
                            subfolder_item.Items.Add(try_again_item);
                        }
                        else
                        {
                            SparkleMenuItem pause_item = new SparkleMenuItem {
                                Header = "Pause"
                            };
                            pause_item.Click +=
                                (sender, e) => Controller.PauseDelegate(project.Name)(sender, e);
                            subfolder_item.Items.Add(pause_item);
                        }
                    }

                    this.context_menu.Items.Add(subfolder_item);
                    i++;
                }
                ;
            }

            folder_item.Items.Add(this.log_item);
            folder_item.Items.Add(add_item);
            folder_item.Items.Add(new Separator());
            folder_item.Items.Add(notify_item);
            folder_item.Items.Add(new Separator());
            folder_item.Items.Add(link_code_item);
            folder_item.Items.Add(new Separator());
            folder_item.Items.Add(about_item);

            this.context_menu.Items.Add(new Separator());
            this.context_menu.Items.Add(this.exit_item);

            this.notify_icon.ContextMenu = this.context_menu;
        }
        public SparkleSetupWindow()
        {
            Title      = "SparkleShare Setup";
            Width      = 640;
            Height     = 440;
            ResizeMode = ResizeMode.NoResize;
            Background = new SolidColorBrush(Colors.WhiteSmoke);
            Icon       = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");

            TaskbarItemInfo = new TaskbarItemInfo()
            {
                Description = "SparkleShare"
            };

            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            Content = ContentCanvas;

            // Remove the close button
            Closing           += Close;
            SourceInitialized += delegate {
                const int           gwl_style  = -16;
                const int           ws_sysmenu = 0x00080000;
                WindowInteropHelper helper     = new WindowInteropHelper(this);
                int style = GetWindowLong(helper.Handle, gwl_style);
                SetWindowLong(helper.Handle, gwl_style, style & ~ws_sysmenu);
            };

            this.bar = new Rectangle()
            {
                Width  = Width,
                Height = 40,
                Fill   = new SolidColorBrush(Color.FromRgb(240, 240, 240))
            };

            this.line = new Rectangle()
            {
                Width  = Width,
                Height = 1,
                Fill   = new SolidColorBrush(Color.FromRgb(223, 223, 223))
            };

            this.side_splash = new Image()
            {
                Width  = 150,
                Height = 482
            };

            this.side_splash.Source = SparkleUIHelpers.GetImageSource("side-splash");


            ContentCanvas.Children.Add(this.bar);
            Canvas.SetRight(bar, 0);
            Canvas.SetBottom(bar, 0);

            ContentCanvas.Children.Add(this.line);
            Canvas.SetRight(this.line, 0);
            Canvas.SetBottom(this.line, 40);

            ContentCanvas.Children.Add(this.side_splash);
            Canvas.SetLeft(this.side_splash, 0);
            Canvas.SetBottom(this.side_splash, 0);
        }