0

I'm trying to make an autoupdater for my program and basically it just opens my program while keeping the autoupdater open.

I tried changing the version and the code worked (closing and opening dl link).

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using MaterialSkin;
using MaterialSkin.Controls;

namespace Sinips
{
    public partial class Form1 : MaterialForm
    {
        public Form1()
        {
            InitializeComponent();
            var materialSkinManager = MaterialSkinManager.Instance;
            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme = MaterialSkinManager.Themes.DARK;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.Grey900, Primary.Grey800, Primary.Grey800, Accent.LightBlue200, TextShade.WHITE);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            WebClient checkVer = new WebClient();
            string Version = checkVer.DownloadString("https://pastebin.com/raw/vSLsy7CF");
            if(Version != "1.0.0")
            {
                WebClient dl = new WebClient();
                string link = dl.DownloadString("https://pastebin.com/raw/ALTc67JZ");
                System.Diagnostics.Process.Start(link);
                this.Close();
            }
            else
            { 
                Form2 main = new Form2();
                this.Hide();
                main.Show();
            }
        }
    }
}

1 Answers1

1

Try setting visible to be false

 this.Visible=false;
 Form2 main = new Form2();
 main.Show();
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396