AcManager.Tools.Helpers.WindowsHelper.ViewInBrowser C# (CSharp) Method

ViewInBrowser() private method

private ViewInBrowser ( [ url ) : void
url [
return void
        public static void ViewInBrowser([CanBeNull] string url) {
            if (string.IsNullOrWhiteSpace(url)) return;
            Process.Start(url);
        }

Usage Example

Esempio n. 1
0
        public static async Task DownloadCarAsync([NotNull] string id, string version = null)
        {
            try {
                var entry = await CmApiProvider.GetContentAsync <AcContentEntry>($"car/{id}");

                if (entry != null)
                {
                    if (version != null && entry.UiVersion != version && entry.OriginVersion != version)
                    {
                        throw new InformativeException($"Can’t download car “{id}”",
                                                       $"Not the required version: indexed is {entry.UiVersion ?? entry.OriginVersion}, while required is {version}.");
                    }

                    if (!entry.ImmediateDownload && entry.OriginUrl != null && (Keyboard.Modifiers & ModifierKeys.Control) == 0)
                    {
                        WindowsHelper.ViewInBrowser(entry.OriginUrl);
                    }
                    else
                    {
                        await ContentInstallationManager.Instance.InstallAsync(entry.DownloadUrl, new ContentInstallationParams(false) {
                            DisplayName    = entry.UiName,
                            Version        = entry.UiVersion,
                            InformationUrl = entry.OriginUrl
                        });
                    }
                }
                else
                {
                    throw new InformativeException($"Can’t download car “{id}”", "Attempt to find a description failed.");
                }
            } catch (Exception e) {
                NonfatalError.Notify($"Can’t download car “{id}”", e);
            }
        }