示例#1
0
        public AboutBox()
        {
            InitializeComponent();

            Text = String.Format("About {0}", AssemblyTitle);
            logoPictureBox.Image  = ApplicationIcon();
            labelProductName.Text = AssemblyProduct;
            labelVersion.Text     = String.Format("Version {0} ({1})",
                                                  PreferencesFactory.get().getProperty("application.version"),
                                                  PreferencesFactory.get().getProperty("application.revision"));
            labelCopyright.Text = Copyright();

            Font bigBoldFont = new Font(Font.FontFamily, Font.Size + 4, FontStyle.Bold);

            labelProductName.Font = bigBoldFont;

            labelRegistered.Text = RegisteredText();

            creditsRichTextBox.Rtf = Credits();
            creditsRichTextBox.SelectAll();
            creditsRichTextBox.SelectionFont = new Font(Font.FontFamily, 9);
            creditsRichTextBox.DeselectAll();
            creditsRichTextBox.LinkClicked += (sender, e) => BrowserLauncherFactory.get().open(e.LinkText);

            ackButton.Click +=
                delegate { ApplicationLauncherFactory.get().open(LocalFactory.get("Acknowledgments.rtf")); };
            PeriodicUpdateChecker updater = PeriodicUpdateCheckerFactory.get();

            updateButton.Enabled = updater.hasUpdatePrivileges();
            updateButton.Click  += delegate { updater.check(false); };
        }
示例#2
0
        public static TaskDialogResult MessageBox(IWin32Window owner, string title, string message, string content,
                                                  string expandedInfo, string help, string verificationText, DialogResponseHandler handler)
        {
            TaskDialogResult result = TaskDialog.Show(
                owner: owner?.Handle ?? IntPtr.Zero,
                title: title,
                mainInstruction: message,
                content: content,
                footerText: FormatHelp(help),
                expandedInfo: expandedInfo,
                verificationText: verificationText,
                commonButtons: TaskDialogCommonButtons.OK,
                mainIcon: TaskDialogIcon.Information,
                callback: (dialog, args, callbackData) =>
            {
                switch (args.Notification)
                {
                case TaskDialogNotification.HyperlinkClicked:
                    BrowserLauncherFactory.get().open(args.Hyperlink);
                    return(true);
                }
                return(false);
            });

            handler(result.CommandButtonResult ?? -1, result.VerificationChecked ?? false);
            return(result);
        }
示例#3
0
        public void Show()
        {
            int uses = PreferencesFactory.get().getInteger("uses");

            var notify = (ToolstripNotificationService)NotificationServiceFactory.get();

            var result = TaskDialog.Show(
                owner: IntPtr.Zero,
                allowDialogCancellation: true,
                title: Localize("Please Donate") + " (" + uses + ")",
                verificationText: Localize("Don't show again for this version"),
                mainInstruction: Localize("Thank you for using Cyberduck!"),
                content: $@"{Localize("This is free software, but it still costs money to write, support, and distribute it. If you enjoy using it, please consider a donation to the authors of this software. It will help to make Cyberduck even better!")} {Localize("As a contributor to Cyberduck, you receive a registration key that disables this prompt.")}",
                commandLinks: new[] { Localize("Donate"), Localize("Later"), Localize("Buy in Windows Store") },
                verificationByDefault: Assembly.GetExecutingAssembly().GetName().Version.ToString().Equals(PreferencesFactory.get().getProperty("donate.reminder")));

            if (result.VerificationChecked == true)
            {
                PreferencesFactory.get().setProperty("donate.reminder", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            }

            if (result.CommandButtonResult == 0)
            {
                BrowserLauncherFactory.get().open(PreferencesFactory.get().getProperty("website.donate"));
            }
            if (result.CommandButtonResult == 2)
            {
                BrowserLauncherFactory.get().open(PreferencesFactory.get().getProperty("website.store"));
            }

            PreferencesFactory.get().setProperty("donate.reminder.date", DateTime.Now.Ticks);
        }
        public void Show()
        {
            int uses = PreferencesFactory.get().getInteger("uses");

            var notify = (ToolstripNotificationService)NotificationServiceFactory.get();

            var result = TaskDialog.Show(
                owner: IntPtr.Zero,
                allowDialogCancellation: true,
                title: Localize("Please Donate") + " (" + uses + ")",
                verificationText: Localize("Don't show again for this version."),
                mainInstruction: Localize("Thank you for using Cyberduck!"),
                content: $@"{Localize("It has taken many nights to develop this application. If you enjoy using it, please consider a donation to the author of this software. It will help to make Cyberduck even better!")}

{Localize("The payment can be made simply and safely using Paypal. You don't need to open an account.")}",
                expandedInfo: $@"{Localize("Donation Key")}

{Localize("As a contributor to Cyberduck, you receive a donation key that disables this prompt.")}",
                commandLinks: new[] { Localize("Donate!"), Localize("Later") },
                expandedByDefault: true,
                verificationByDefault: Assembly.GetExecutingAssembly().GetName().Version.ToString().Equals(PreferencesFactory.get().getProperty("donate.reminder")));

            if (result.VerificationChecked == true)
            {
                PreferencesFactory.get().setProperty("donate.reminder", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            }

            if (result.CommandButtonResult == 0)
            {
                BrowserLauncherFactory.get().open(PreferencesFactory.get().getProperty("website.donate"));
            }

            PreferencesFactory.get().setProperty("donate.reminder.date", DateTime.Now.Ticks);
        }
 protected override void OnLinkClicked(LinkLabelLinkClickedEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         BrowserLauncherFactory.get().open(Text);
     }
     base.OnLinkClicked(e);
 }
示例#6
0
        public bool alert(Host host, BackgroundException failure, StringBuilder log)
        {
            FailureDiagnostics.Type type = _diagnostics.determine(failure);
            if (type == FailureDiagnostics.Type.cancel)
            {
                return(false);
            }
            _notification.alert(host, failure, log);
            bool r = false;

            _controller.Invoke(delegate
            {
                string footer   = ProviderHelpServiceFactory.get().help(host.getProtocol());
                string title    = LocaleFactory.localizedString("Error");
                string message  = failure.getMessage() ?? LocaleFactory.localizedString("Unknown");
                string detail   = failure.getDetail() ?? LocaleFactory.localizedString("Unknown");
                string expanded = log.length() > 0 ? log.toString() : null;
                string commandButtons;
                if (type == FailureDiagnostics.Type.network)
                {
                    commandButtons = String.Format("{0}|{1}", LocaleFactory.localizedString("Try Again", "Alert"),
                                                   LocaleFactory.localizedString("Network Diagnostics", "Alert"));
                }
                else if (type == FailureDiagnostics.Type.quota)
                {
                    commandButtons = String.Format("{0}|{1}", LocaleFactory.localizedString("Try Again", "Alert"),
                                                   LocaleFactory.localizedString("Help", "Main"));
                }
                else
                {
                    commandButtons = String.Format("{0}", LocaleFactory.localizedString("Try Again", "Alert"));
                }
                _controller.WarningBox(title, message, detail, expanded, commandButtons, true, footer,
                                       delegate(int option, bool @checked)
                {
                    switch (option)
                    {
                    case 0:
                        r = true;
                        break;

                    case 1:
                        if (type == FailureDiagnostics.Type.network)
                        {
                            ReachabilityFactory.get().diagnose(host);
                        }
                        if (type == FailureDiagnostics.Type.quota)
                        {
                            BrowserLauncherFactory.get().open(new DefaultProviderHelpService().help(host.getProtocol()));
                        }
                        r = false;
                        break;
                    }
                });
            }, true);
            return(r);
        }
示例#7
0
        public ProfileViewModel(ProfileDescription profile)
        {
            ProfileDescription = profile;
            Profile            = (Profile)profile.getProfile().get();
            Installed          = profile.isInstalled() && Profile.isEnabled();
            IsEnabled          = !(Profile.isBundled() || Utils.ConvertFromJavaList <Host>(BookmarkCollection.defaultCollection()).Any(x => x.getProtocol().Equals(Profile)));

            OpenHelp = ReactiveCommand.Create(() =>
            {
                BrowserLauncherFactory.get().open(ProviderHelpServiceFactory.get().help(Profile));
            });
        }
示例#8
0
        public void setup()
        {
            ContextMenuStrip  rightMenu  = new ContextMenuStrip();
            ToolStripMenuItem itemUpdate = new ToolStripMenuItem
            {
                Text = LocaleFactory.get().localize("Check for Update…", "Main")
            };
            PeriodicUpdateChecker updater = PeriodicUpdateCheckerFactory.get();

            itemUpdate.Enabled = updater.hasUpdatePrivileges();
            itemUpdate.Click  += delegate { updater.check(false); };
            ToolStripMenuItem itemDonate = new ToolStripMenuItem
            {
                Text = LocaleFactory.get().localize("Donate…", "Main")
            };

            itemDonate.Click +=
                delegate { BrowserLauncherFactory.get().open(PreferencesFactory.get().getProperty("website.donate")); };
            ToolStripMenuItem itemKey = new ToolStripMenuItem {
                Text = LicenseFactory.find().ToString(), Enabled = false
            };
            ToolStripMenuItem itemExit = new ToolStripMenuItem
            {
                Text = LocaleFactory.get().localize("Exit", "Localizable")
            };

            itemExit.Click += delegate { MainController.Exit(false); };
            rightMenu.Items.AddRange(new ToolStripItem[]
                                     { itemUpdate, new ToolStripSeparator(), itemDonate, itemKey, new ToolStripSeparator(), itemExit });

            try
            {
                _icon.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            }
            catch (ArgumentException)
            {
            }
            _icon.Visible          = true;
            _icon.ContextMenuStrip = rightMenu;

            _icon.MouseClick += delegate(object sender, MouseEventArgs args)
            {
                if (args.Button == MouseButtons.Left)
                {
                    foreach (BrowserController browser in MainController.Browsers)
                    {
                        browser.View.Activate();
                        browser.View.BringToFront();
                    }
                }
            };
        }
        public void Show()
        {
            int uses = PreferencesFactory.get().getInteger("uses");

            View.Title             = LocaleFactory.localizedString("Please Donate", "Donate") + " (" + uses + ")";
            View.NeverShowDonation =
                Assembly.GetExecutingAssembly()
                .GetName()
                .Version.ToString()
                .Equals(PreferencesFactory.get().getProperty("donate.reminder"));
            if (DialogResult.OK == View.ShowDialog())
            {
                BrowserLauncherFactory.get().open(PreferencesFactory.get().getProperty("website.donate"));
            }
            if (View.NeverShowDonation)
            {
                PreferencesFactory.get()
                .setProperty("donate.reminder", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            }
            // Remeber this reminder date
            PreferencesFactory.get().setProperty("donate.reminder.date", DateTime.Now.Ticks);
        }
示例#10
0
 private void View_OpenUrl()
 {
     BrowserLauncherFactory.get().open(new HostUrlProvider().get(_host));
 }
示例#11
0
 private void View_OpenWebUrl()
 {
     BrowserLauncherFactory.get().open(new WebUrlProvider(_host).toUrl().getUrl());
 }