private void CheckForUpdate_Click(object sender, RoutedEventArgs e)
 {
     GithubReleaseClient updater = new GithubReleaseClient(Constant.ApplicationName, this.latestReleaseAddress);
     if (updater.TryGetAndParseRelease(true))
     {
         this.MostRecentCheckForUpdate = DateTime.UtcNow;
     }
 }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // abort if required dependencies are missing
            if (Dependencies.AreRequiredBinariesPresent(Constant.ApplicationName, Assembly.GetExecutingAssembly()) == false)
            {
                Dependencies.ShowMissingBinariesDialog(Constant.ApplicationName);
                if (Application.Current != null)
                {
                    Application.Current.Shutdown();
                }
            }

            // check for updates
            if (DateTime.UtcNow - this.state.MostRecentCheckForUpdates > Constant.CheckForUpdateInterval)
            {
                Uri latestVersionAddress = CarnassialConfigurationSettings.GetLatestReleaseApiAddress();
                if (latestVersionAddress == null)
                {
                    return;
                }

                GithubReleaseClient updater = new GithubReleaseClient(Constant.ApplicationName, latestVersionAddress);
                updater.TryGetAndParseRelease(false);
                this.state.MostRecentCheckForUpdates = DateTime.UtcNow;
            }

            // if a file was passed on the command line, try to open it
            // args[0] is the .exe
            string[] args = Environment.GetCommandLineArgs();
            if (args != null && args.Length > 1)
            {
                string filePath = args[1];
                string fileExtension = Path.GetExtension(filePath);
                if (String.Equals(fileExtension, Constant.File.TemplateFileExtension, StringComparison.OrdinalIgnoreCase))
                {
                    await this.TryOpenTemplateAndBeginLoadFoldersAsync(filePath);
                }
                else if (String.Equals(fileExtension, Constant.File.FileDatabaseFileExtension, StringComparison.OrdinalIgnoreCase))
                {
                    string[] templatePaths = Directory.GetFiles(Path.GetDirectoryName(filePath), "*" + Constant.File.TemplateFileExtension);
                    if (templatePaths != null && templatePaths.Length == 1)
                    {
                        await this.TryOpenTemplateAndBeginLoadFoldersAsync(templatePaths[0]);
                    }
                }
            }
        }