Exemple #1
0
        private LinkContentEditorContext(StatusControlContext statusContext)
        {
            StatusContext = statusContext ?? new StatusControlContext();

            SaveCommand             = StatusContext.RunBlockingTaskCommand(async() => await SaveAndGenerateHtml(false));
            SaveAndCloseCommand     = StatusContext.RunBlockingTaskCommand(async() => await SaveAndGenerateHtml(true));
            ExtractDataCommand      = StatusContext.RunBlockingTaskCommand(ExtractDataFromLink);
            OpenUrlInBrowserCommand = StatusContext.RunNonBlockingActionCommand(() =>
            {
                try
                {
                    if (string.IsNullOrWhiteSpace(LinkUrlEntry.UserValue))
                    {
                        StatusContext.ToastWarning("Link is Blank?");
                    }
                    var ps = new ProcessStartInfo(LinkUrlEntry.UserValue)
                    {
                        UseShellExecute = true, Verb = "open"
                    };
                    Process.Start(ps);
                }
                catch (Exception e)
                {
                    StatusContext.ToastWarning($"Trouble opening link - {e.Message}");
                }
            });
        }