Exemple #1
0
        private void uninstall_Click(object sender, EventArgs e)
        {
            Readdy rd = (Readdy)this.stepPanel.Controls[0];

            rd.uninstall.Click -= new EventHandler(uninstall_Click);;
            rd.cancel.Click    -= new EventHandler(cancel_Click);
            bool  canCreateNew;
            Mutex m = new Mutex(true, Settings.mutexName, out canCreateNew);

            if (!canCreateNew)
            {
                CloseApp ca = new CloseApp();
                ca.richTextBox1.AppendText("ZLPlayer.exe");
                ca.continueBtn.Click += new EventHandler(continueBtn_Click);
                this.stepPanel.Controls.RemoveAt(0);
                this.stepPanel.Controls.Add(ca);
                rd.Dispose();
                return;
            }
            m.ReleaseMutex();
            UnInstalling ui = new UnInstalling();

            this.stepPanel.Controls.RemoveAt(0);
            this.stepPanel.Controls.Add(ui);

            rd.Dispose();
            uninstalling = true;
            backgroundWorker1.RunWorkerAsync();
        }
Exemple #2
0
        public Form1()
        {
            if (!IsRunAsAdmin())
            {
                // Launch itself as administrator
                ProcessStartInfo proc = new ProcessStartInfo();
                proc.UseShellExecute  = true;
                proc.WorkingDirectory = Environment.CurrentDirectory;
                proc.FileName         = Application.ExecutablePath;
                proc.Verb             = "runas";

                try
                {
                    Process.Start(proc);
                }
                catch
                {
                    // The user refused to allow privileges elevation.
                    // Do nothing and return directly ...
                    return;
                }

                this.Close();  // Quit itself
                return;
            }
            InitializeComponent();
            string[] para = Environment.GetCommandLineArgs();
            appKey = "ZLPlayer";
            string tag = "ZJUNINSATLL";

            foreach (string o in para)
            {
                if (o.StartsWith(tag))
                {
                    installDir = o.Replace("?", " ").Substring(tag.Length, o.Length - tag.Length);

                    break;
                }
            }
            if (string.IsNullOrEmpty(installDir) || !Directory.Exists(installDir))
            {
                Environment.Exit(0);
                return;
            }
            startMenu    = Path.Combine(Path.Combine(Settings.userStartMenu, Settings.company), Settings.appName);
            destopMenu   = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), Settings.appName + ".lnk");
            unregistfile = "/regflac,ape,aac,tta,mp3,wav,tak,cue,ofr,wv,m4a,ogg,";

            Readdy rd = new Readdy();

            rd.uninstall.Click += new EventHandler(uninstall_Click);
            rd.cancel.Click    += new EventHandler(cancel_Click);
            this.stepPanel.Controls.Add(rd);
        }
Exemple #3
0
        public Form1()
        {
            if (!IsRunAsAdmin())
            {
                // Launch itself as administrator
                ProcessStartInfo proc = new ProcessStartInfo();
                proc.UseShellExecute = true;
                proc.WorkingDirectory = Environment.CurrentDirectory;
                proc.FileName = Application.ExecutablePath;
                proc.Verb = "runas";

                try
                {
                    Process.Start(proc);
                }
                catch
                {
                    // The user refused to allow privileges elevation.
                    // Do nothing and return directly ...
                    return;
                }

                this.Close();  // Quit itself
                return;
            }
            InitializeComponent();
            string[] para = Environment.GetCommandLineArgs();
            appKey = "ZLPlayer";
            string tag = "ZJUNINSATLL";
            foreach (string o in para)
            {
                if (o.StartsWith(tag))
                {

                    installDir = o.Replace("?"," ").Substring(tag.Length, o.Length - tag.Length);

                    break;
                }
            }
            if (string.IsNullOrEmpty(installDir) || !Directory.Exists(installDir))
            {
                Environment.Exit(0);
                return;
            }
            startMenu = Path.Combine(Path.Combine(Settings.userStartMenu, Settings.company), Settings.appName);
            destopMenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop),Settings.appName+".lnk");
            unregistfile = "/regflac,ape,aac,tta,mp3,wav,tak,cue,ofr,wv,m4a,ogg,";

            Readdy rd = new Readdy();
            rd.uninstall.Click += new EventHandler(uninstall_Click);
            rd.cancel.Click += new EventHandler(cancel_Click);
            this.stepPanel.Controls.Add(rd);
        }