예제 #1
0
 private void On_Committed(object sender, InstallEventArgs e)
 {
     InternetBlocker.block(false);
     if (installingProcess)
     {
         MessageBox.Show("ההתקנה הסתיימה, לחץ למעבר למסך ההגדרה הראשוני", "לוקחים אחריות", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification);
         Program.StartAgainAsAdmin();
     }
 }
예제 #2
0
        protected override void OnBeforeUninstall(IDictionary savedState)
        {
            base.OnBeforeInstall(savedState);

            //Prevent uninstalling while the app is on
            if (!IsAllAppClosed("MMB-Filter"))
            {
                MessageBox.Show("לפני הסרת התקנה יש לסגור את המערכת. סגור את המערכת ולאחר מכן נסה שנית.");
                throw new ApplicationException("לא ניתן להסיר את התוכנה בזמן שאחד המופעים שלה פתוח");
            }

            installingProcess = false;

            //ask for password
            Dialogs.EnterPassword enterPassword = new Dialogs.EnterPassword("על מנת להסיר את ההתקנה יש להזין סיסמת מנהל", true);
            DialogResult          dialogResult  = enterPassword.ShowDialog();

            enterPassword.BringToFront();

            if (dialogResult == DialogResult.OK)
            {
                string gettedPass = enterPassword.gettedText;
                if (gettedPass == PasswordEncryption.Decrypt(Installer.GetUninstallingPass()) || FilteringSystem.IsAdminPassword(gettedPass))
                {
                    string localDataPath = Environment.ExpandEnvironmentVariables("%localappdata%") + @"\MMB\";

                    try
                    {
                        //Delete the appData
                        Directory.Delete(localDataPath, true);
                    }
                    catch
                    {}
                    //Set dhcp dns
                    DnsController.setMode(false);

                    //Stop the internt blocker service
                    ServiceAdapter.StopService("GUIAdapter", 10000);

                    //Uninstall the Service
                    string servicePath = Assembly.GetExecutingAssembly().CodeBase;
                    servicePath = servicePath.Replace("MMB-Filter.exe", "MMB-Service.exe");
                    ServiceAdapter.UninstallService(servicePath);

                    //realese the internet blocking
                    InternetBlocker.block(false);

                    MessageBox.Show("הסרת ההתקנה הסתיימה", "לוקחים אחריות", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification);
                }
                else
                {
                    MessageBox.Show("הסיסמה שגויה, התראה נשלחה למנהל המערכת", "לוקחים אחריות", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    throw new ApplicationException("לא ניתן להסיר באמצעות סיסמה שגויה");
                }
            }
        }
예제 #3
0
        private void exitButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("יציאה תוביל לסגירה מלאה של המערכת ולהשבתת הסינון" + Environment.NewLine + "האם אתה בטוח שברצונך לצאת?", "יציאה", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dialogResult == DialogResult.Yes)
            {
                exitButton.Text = "יוצא....";
                CustomNotifyIcon.hide();
                if (ServiceAdapter.GetServiceStatus("GUIAdapter") == "Running")
                {
                    ServiceAdapter.StopService("GUIAdapter", 10000);
                    while (ServiceAdapter.GetServiceStatus("GUIAdapter") != "Stopped")
                    {
                        exitButton.Text = ServiceAdapter.GetServiceStatus("GUIAdapter");
                        ServiceAdapter.StopService("GUIAdapter", 10000);
                        System.Threading.Thread.Sleep(3000);
                    }
                }
                InternetBlocker.block(false);
                Application.ExitThread();
            }
        }