Auto Update

Here you will learn how to add a update check to your application before a user logs in.

First be sure you have created 2 app vars on your config page called ( updateurl ) & ( version )

App Var Example

Once you have created the app vars that are required use the code below to login & verify the version of the app and the version on the site match.

Winforms

private static FusionApp App = new FusionApp("APPID");
private static string currentVersion = "1.0";
private static string liveVersion;
private static string updateurl;

private async void btnLogin_Click(object sender, EventArgs e)
{
    var loginResponse = await App.Login(tbUsername.Text, tbPassword.Text, "", false, false);
    if (loginResponse.Error == false)
    {
        try
        {
             liveVersion = await FusionApp.GetAppVar("version");
             updateurl = await FusionApp.GetAppVar("updateurl");

             if (!string.Equals(currentVersion, liveVersion))
             {
                 DialogResult dialogResult = MessageBox.Show("There is a new update would you like to download it?", "FusionAPI.dev", MessageBoxButtons.YesNo);
                 if (dialogResult == DialogResult.Yes)
                 {
                     Process.Start(updateurl);
                     Application.Exit();
                 }
              }
         }
         catch
         {
             MessageBox.Show("Failed to get update!", "FusionAPI.dev");
         }
         
         Hide();
         new Main().Show();
     }
     else
     {
         MessageBox.Show(loginResponse.Message, "FusionAPI.dev");
     }
}

Last updated