Beispiel #1
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (!done & !skip)
            {
                try
                {
                    TaskDialog td = new TaskDialog();
                    td.Caption         = "Shutdown7";
                    td.InstructionText = Data.L["Cancel"];
                    td.Text            = Data.L["ConfirmAbortWelcomeScreen"];
                    td.Icon            = TaskDialogStandardIcon.Warning;
                    td.StandardButtons = TaskDialogStandardButtons.No | TaskDialogStandardButtons.Cancel;
                    td.Cancelable      = true;
                    if (td.Show() == TaskDialogResult.No)
                    {
                        e.Cancel = true;
                        return;
                    }
                }
                catch
                {
                    if (MessageBox.Show(Data.L["ConfirmAbortWelcomeScreen"], "Shutdown7", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.No)
                    {
                        e.Cancel = true;
                        return;
                    }
                }
            }

            Xml.Write();

            ProcessStartInfo p = new ProcessStartInfo();

            p.FileName         = Data.EXE;
            p.WorkingDirectory = Directory.GetCurrentDirectory();
            p.Verb             = "runas";
            Process.Start(p);
            //Message.Show(L["RequireAdmin"], "Error");
            Environment.Exit(0);
        }
Beispiel #2
0
 public static void MigrateIni()
 {
     Ini.Read();
     Xml.Write();
     System.IO.File.Delete(Ini.Path);
 }
Beispiel #3
0
        private void buttonNext_Click(object sender, RoutedEventArgs e)
        {
            if (update)
            {
                Close();
            }

            switch (curscreen)
            {
            case 2:
                Data.S["Autostart"] = (bool)checkAutostart.IsChecked;
                break;

            case 3:
                //Data.S["Ask"] = (bool)checkAsk.IsChecked;
                Data.S["Force"]             = (bool)checkForce.IsChecked;
                Data.S["StayAfterShutdown"] = (bool)checkStayAfterShutdown.IsChecked;
                Data.S["SysIcon"]           = (bool)checkSysicon.IsChecked;
                break;

            case 4:
                Data.S["Jumplist"] = (bool)checkJumplist.IsChecked;
                Data.S["Overlay"]  = (bool)checkOverlay.IsChecked;
                //Data.S["Glass"] = (bool)checkGlass.IsChecked;

                if ((bool)checkPinTaskbar.IsChecked)
                {
                    new Thread(Win7.PinToTaskbar).Start();
                }
                break;

            case 5:
                Data.S["RemoteClient"] = (bool)checkRemoteClient.IsChecked;
                Data.S["RemoteServer"] = (bool)checkRemoteServer.IsChecked;
                if (!(bool)checkRemoteServer.IsChecked)
                {
                    curscreen++;
                }
                break;

            case 6:
                if (!Int32.TryParse(textRemotePort.Text, out Data.RemotePort) | (Data.RemotePort < 1024 | Data.RemotePort > 65535))
                {
                    MessageBox.Show(Data.L["RemotePortMissing"], "Shutdown7", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                if (textRemotePassword.Password.Length == 0)
                {
                    MessageBox.Show(Data.L["RemotePasswordMissing"], "Shutdown7", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                Data.RemotePassword = Remote.md5(textRemotePassword.Password);
                break;

            case 7:
                Data.S["WOSB"] = (bool)checkWOSB.IsChecked;
                if (!(bool)checkWOSB.IsChecked)
                {
                    curscreen++;
                }
                else
                {
                    Data.W.Add("Default", new Dictionary <string, string>());
                    Data.curProfile = "Default";
                }
                break;

            case 8:
                Data.W["Default"]["Mo1"]      = textWOSBTime1.Text;
                Data.W["Default"]["Mo2"]      = textWOSBTime2.Text;
                Data.W["Default"]["Th1"]      = textWOSBTime3.Text;
                Data.W["Default"]["Th2"]      = textWOSBTime4.Text;
                Data.W["Default"]["We1"]      = textWOSBTime5.Text;
                Data.W["Default"]["We2"]      = textWOSBTime6.Text;
                Data.W["Default"]["Th1"]      = textWOSBTime7.Text;
                Data.W["Default"]["Th2"]      = textWOSBTime8.Text;
                Data.W["Default"]["Fr1"]      = textWOSBTime9.Text;
                Data.W["Default"]["Fr2"]      = textWOSBTime10.Text;
                Data.W["Default"]["Sa1"]      = textWOSBTime11.Text;
                Data.W["Default"]["Sa2"]      = textWOSBTime12.Text;
                Data.W["Default"]["Su1"]      = textWOSBTime13.Text;
                Data.W["Default"]["Su2"]      = textWOSBTime14.Text;
                Data.W["Default"]["File"]     = "";
                Data.W["Default"]["Params"]   = "";
                Data.W["Default"]["AwFile"]   = "";
                Data.W["Default"]["AwParams"] = "";
                Data.W["Default"]["Extra"]    = "";
                break;

            case 9:
                Data.S["SendFeedback"] = (bool)checkSendFeedback.IsChecked;
                break;

            default:
                break;
            }

            if (curscreen == Titles.Length - 1)
            {
                Data.RemoteServers = new string[] { "127.0.0.1" };

                Data.RemoteMacs = new string[] { };
                foreach (NetworkInterface CurMac in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (CurMac.OperationalStatus == OperationalStatus.Up)
                    {
                        if (CurMac.GetPhysicalAddress().ToString().Length > 0)
                        {
                            Array.Resize(ref Data.RemoteMacs, Data.RemoteMacs.Length + 1);
                            Data.RemoteMacs[Data.RemoteMacs.Length - 1] = CurMac.GetPhysicalAddress().ToString();
                        }
                    }
                }

                Xml.Write();
                if ((bool)checkWOSB.IsChecked)
                {
                    Xml.WriteWOSB();
                }

                Close();
            }
            else
            {
                curscreen++;
                ChangeScreen(curscreen);
            }
        }