当前位置: 首页>>代码示例>>C#>>正文


C# UpdateManager.UpdateApp方法代码示例

本文整理汇总了C#中Squirrel.UpdateManager.UpdateApp方法的典型用法代码示例。如果您正苦于以下问题:C# UpdateManager.UpdateApp方法的具体用法?C# UpdateManager.UpdateApp怎么用?C# UpdateManager.UpdateApp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Squirrel.UpdateManager的用法示例。


在下文中一共展示了UpdateManager.UpdateApp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShellViewModel

        public ShellViewModel(
            EndpointsViewModel endpoints,
            MessageListViewModel messageList,
            MessageViewerViewModel messageViewer,
            HeadersViewModel headers)
        {
            Version = GetType().Assembly
                .GetCustomAttributes(false)
                .OfType<AssemblyInformationalVersionAttribute>()
                .First()
                .InformationalVersion;

            RefreshCommand = ServiceControl.Instance.IsValid.ToCommand(p => DoRefresh());

            Anchorables = new IContainerViewModel[] { endpoints, messageList };
            Documents = new IContainerViewModel[] { messageViewer, headers };

            Task.Run(async () =>
            {
                using (var mgr = new UpdateManager(@"https://s3.amazonaws.com/serviceinsight/"))
                {
                    await mgr.UpdateApp();
                }
            });
        }
开发者ID:distantcam,项目名称:ServiceInsight2,代码行数:25,代码来源:ShellViewModel.cs

示例2: CheckForAppUpdates

 private async void CheckForAppUpdates()
 {
     using (var updateManager = new UpdateManager(APP_UPDATE_URL, APPLICATION_ID, FrameworkVersion.Net45))
     {
         await updateManager.UpdateApp();
     }
 }
开发者ID:ababhamdi,项目名称:FastCapt,代码行数:7,代码来源:UpdateService.cs

示例3: SquirrellUpdate

 async static void SquirrellUpdate()
 {
     using (var mgr = new UpdateManager(@"C:\DHT\TsunamiLocal\GUI_WPF\bin\x64"))
     {
         await mgr.UpdateApp();
     }
 }
开发者ID:ChristianSacramento,项目名称:Tsunami,代码行数:7,代码来源:MainWindow.xaml.cs

示例4: ScheduleApplicationUpdates

        private async void ScheduleApplicationUpdates(Object o)
        {
            var location = UpdateHelper.AppUpdateCheckLocation;
            var appName = Assembly.GetExecutingAssembly().GetName().Name;
            using (var mgr = new UpdateManager(location, appName, FrameworkVersion.Net45))
            {
                try
                {
                    UpdateInfo updateInfo = await mgr.CheckForUpdate();
                    if (updateInfo.FutureReleaseEntry != null)
                    {
                        if (updateInfo.CurrentlyInstalledVersion.Version == updateInfo.FutureReleaseEntry.Version) return;
                        await mgr.UpdateApp();

                        // This will show a button that will let the user restart the app
                        Dispatcher.Invoke(ShowUpdateIsAvailable);

                        // This will restart the app automatically
                        //Dispatcher.InvokeAsync<Task>(ShutdownApp);
                    }
                }
                catch (Exception ex)
                {
                    var a = ex;
                }
            }
        }
开发者ID:amazzanti,项目名称:Resquirrelly,代码行数:27,代码来源:MainWindow.xaml.cs

示例5: UpgradeRunsSquirrelAwareAppsWithUpgradeFlag

        public async Task UpgradeRunsSquirrelAwareAppsWithUpgradeFlag()
        {
            string tempDir;
            string remotePkgDir;

            using (Utility.WithTempDirectory(out tempDir))
            using (Utility.WithTempDirectory(out remotePkgDir)) {
                IntegrationTestHelper.CreateFakeInstalledApp("0.1.0", remotePkgDir);
                var pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
                ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));

                using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
                    await fixture.FullInstall(false, new ProgressSource());
                }

                await Task.Delay(1000);

                IntegrationTestHelper.CreateFakeInstalledApp("0.2.0", remotePkgDir);
                pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
                ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));

                using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
                    await fixture.UpdateApp();
                }

                await Task.Delay(1000);

                Assert.False(File.Exists(Path.Combine(tempDir, "theApp", "app-0.2.0", "args2.txt")));
                Assert.True(File.Exists(Path.Combine(tempDir, "theApp", "app-0.2.0", "args.txt")));

                var text = File.ReadAllText(Path.Combine(tempDir, "theApp", "app-0.2.0", "args.txt"), Encoding.UTF8);
                Assert.Contains("updated|0.2.0", text);
            }
        }
开发者ID:fusetools,项目名称:Squirrel.Windows,代码行数:34,代码来源:ApplyReleasesTests.cs

示例6: Update

        private static async Task Update()
        {
            try
            {
                using (var mgr = new UpdateManager("http://lunyx.net/CasualMeter"))
                {
                    Logger.Info("Checking for updates.");
                    if (mgr.IsInstalledApp)
                    {
                        Logger.Info($"Current Version: v{mgr.CurrentlyInstalledVersion()}");
                        var updates = await mgr.CheckForUpdate();
                        if (updates.ReleasesToApply.Any())
                        {
                            Logger.Info("Updates found. Applying updates.");
                            var release = await mgr.UpdateApp();

                            MessageBox.Show(CleanReleaseNotes(release.GetReleaseNotes(Path.Combine(mgr.RootAppDirectory, "packages"))),
                                $"Casual Meter Update - v{release.Version}");

                            Logger.Info("Updates applied. Restarting app.");
                            UpdateManager.RestartApp();
                        }
                    }
                }
            }
            catch (Exception e)
            {   //log exception and move on
                HandleException(e);
            }
        }
开发者ID:DzenDyn,项目名称:CasualMeter,代码行数:30,代码来源:App.xaml.cs

示例7: ProcessStaging

 public async void ProcessStaging()
 {
     using (var mgr = new UpdateManager("https://path/to/my/update/folder"))
     {
         await mgr.UpdateApp();
     }
 }
开发者ID:faint32,项目名称:snowflake-1,代码行数:7,代码来源:StagingUpdater.cs

示例8: CheckAndUpdate

        /// <summary>
        /// Squirrel check and update.
        /// </summary>
        private async Task CheckAndUpdate(bool checkOnly = false)
        {
            // 6/27/15 - Task.Wait always times out. Seems to be an issue with the return of Squirrel's async methods.
            try
            {
                AddMessage("Start of CheckAndUpdate");
                using (var updateManager = new UpdateManager(Program.PackageUrl, Program.PackageId))
                {
                    // Check
                    AddMessage(String.Format("UpdateManager: {0}", JsonConvert.SerializeObject(updateManager, Formatting.Indented)));
                    AddMessage("Calling UpdateManager.CheckForUpdate");
                    var updateInfo = await updateManager.CheckForUpdate();
                    AddMessage(String.Format(
                                        "UpdateManager.CheckForUpdate returned UpdateInfo: {0}", 
                                        JsonConvert.SerializeObject(updateInfo, Formatting.Indented)));
                    if (checkOnly) { return; }

                    // Update
                    if (updateInfo.ReleasesToApply.Count > 0)
                    {
                        AddMessage("Calling UpdateManager.UpdateApp");
                        var releaseEntry = await updateManager.UpdateApp();
                        AddMessage(String.Format(
                                            "UpdateManager.UpdateApp returned ReleaseEntry: {0}",
                                            JsonConvert.SerializeObject(releaseEntry, Formatting.Indented)));
                    }
                    else { AddMessage("No updates to apply"); }
                }
            }
            catch (Exception exception) 
            { 
                Log.Error("Exception in CheckAndUpdate", exception);
                throw;
            }
        }
开发者ID:DaneVinson,项目名称:Nuts,代码行数:38,代码来源:MainForm.cs

示例9: App

 public App()
 {
     InitializeComponent();
     AppearanceManager.Current.ThemeSource = AppearanceManager.DarkThemeSource;
     Task.Factory.StartNew(async () =>
     {
         AboutViewModel.Instance.State = "Updater process started";
         await Task.Delay(TimeSpan.FromSeconds(1));
         while (true)
         {
             try
             {
                 AboutViewModel.Instance.State = "Ready for the first check...";
                 using (var updateManager = new UpdateManager(Releases))
                 {
                     AboutViewModel.Instance.State = "Updating...";
                     await updateManager.UpdateApp();
                     AboutViewModel.Instance.State = "Updated!";
                 }
             }
             catch (Exception x)
             {
                 AboutViewModel.Instance.State = x.Message;
                 return;
             }
             await Task.Delay(TimeSpan.FromHours(1));
         }
     });
 }
开发者ID:marhoily,项目名称:Approve.exe,代码行数:29,代码来源:App.xaml.cs

示例10: toolStripButtonCheckForUpdates_Click

        private async void toolStripButtonCheckForUpdates_Click(object sender, EventArgs e)
        {
            // NB: For this version, always say your app is using .NET 4.5, even if it's
            // totally not
            using (var mgr = new UpdateManager(textBoxPathForUpdate.Text))
            {
               var release = await mgr.UpdateApp();

               if (release != null)
               {
                   MessageBox.Show("New App Version Installed " + release.Version + " \n Close and reopen to load new version.");
               }
            }
        }
开发者ID:maurocavallin,项目名称:WinFormsSquirrelExample,代码行数:14,代码来源:MainForm.cs

示例11: Main

        private static void Main()
        {
            Task.Run(async () =>
            {
                var upgraded = false;
                while (!upgraded)
                {
                    await Task.Delay(TimeSpan.FromSeconds(5));

                    using (
                        var mgr = new UpdateManager(@"http://distribute.klonmaschine.de/metrothing/", "metrothing",
                            FrameworkVersion.Net45))
                    {
                        SquirrelAwareApp.HandleEvents(
                            v => mgr.CreateShortcutForThisExe(),
                            v => mgr.CreateShortcutForThisExe(),
                            onAppUninstall: v => mgr.RemoveShortcutForThisExe());

                        // Try the update
                        try
                        {
                            var updateInfo = await mgr.CheckForUpdate();

                            if (updateInfo != null && updateInfo.ReleasesToApply.Count > 0)
                            {
            #if !DEBUG
                                await mgr.UpdateApp();
            #endif

                                upgraded = true;
                                Singleton<InstallationManager>.Instance.Updated(
                                    updateInfo.FutureReleaseEntry.Version.ToString(),
                                    String.Join("", updateInfo.FetchReleaseNotes().Values));
                            }
                        }
                        catch (Exception e)
                        {
                            Trace.WriteLine("Squirrel update failed: " + e.Message);
                        }
                    }

                    if (!upgraded)
                        await Task.Delay(TimeSpan.FromHours(12));
                }
            });

            MetroThing.Program.Main();
        }
开发者ID:kreischweide,项目名称:metrothing,代码行数:48,代码来源:Program.cs

示例12: ButtonUpdateDo_OnClick

 private async void ButtonUpdateDo_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         using (var mgr = new UpdateManager(ConfigurationManager.AppSettings["UpdatePath"]))
         {
             var release = await mgr.UpdateApp();
            
             this.UpdateDoResult.Text = release.EntryAsString;
         }
     }
     catch (Exception test)
     {
         this.UpdateDoResult.Text = "Updated to: " + test.Message;
     }
 }
开发者ID:davidalmas,项目名称:Samples,代码行数:16,代码来源:MainWindow.xaml.cs

示例13: bw_DoWork

 async void bw_DoWork(object sender, DoWorkEventArgs e) {
     do {
         try {
             using (var mgr = new UpdateManager(@"C:\dev\helloworld\HelloWorld\Releases", "HelloWorldSquirrel")) {
                 var updateInfo = await mgr.CheckForUpdate(false, progress => { });
                 if (updateInfo != null && updateInfo.ReleasesToApply.Count != 0) {
                     await mgr.UpdateApp();
                     Restart = true;                            
                 }
             }
         } catch (Exception ex) {
             Console.WriteLine(ex.StackTrace);
         }
         Console.WriteLine("I am running");
         Thread.Sleep(2000);
     } while (true);
 }
开发者ID:jcoulter,项目名称:WPF_squirrel_HelloWorld,代码行数:17,代码来源:MainWindow.xaml.cs

示例14: MainWindow_Loaded

 private void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     Task.Run(async () =>
     {
         using (var mgr = new UpdateManager(@"https://s3-eu-west-1.amazonaws.com/squirrelpackager"))
         {
             try
             {
                 await mgr.UpdateApp();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("From Update Manager : " + Environment.NewLine + ex.InnerException.Message + Environment.NewLine + ex.Message);
             }
         }
     });
 }
开发者ID:tenacious,项目名称:Auto.Squirrel,代码行数:17,代码来源:ShellView.xaml.cs

示例15: CheckForUpdate

 private void CheckForUpdate(long x)
 {
     #if !DEBUG
     Task.Run(async () => {
         try {
             using (var mgr = new UpdateManager(UpdateFolder)) {
                 var release = await mgr.UpdateApp();
                 if (release.Version > mgr.CurrentlyInstalledVersion()) {
                     OnNewVersionAvailable(release);
                 }
             }
         } catch (Exception e) {
             _logger.Error(e, "Failed checking for updates: {0}", e.Message);
             _crashManager.Report(e, "squirrel");
         }
     });
     #endif
 }
开发者ID:freezy,项目名称:vpdb-agent,代码行数:18,代码来源:VersionManager.cs


注:本文中的Squirrel.UpdateManager.UpdateApp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。