private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var hwnd = new WindowInteropHelper(this).Handle;

            SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);

            pathToFolder = Directory.GetCurrentDirectory();
            Uri     ftp              = new Uri("ftp://[email protected]/Versions/Last_Version.txt");
            Version newUpdate        = new Version(pathToFolder, ftp, password, user);
            var     installedVersion = newUpdate.getCurrentVersion();

            if (installedVersion != 0)
            {
                newUpdate.SetRemoteVersion();

                if (newUpdate.ConnectFlag != false)
                {
                    var remoteVersion = newUpdate.getRemoteVersionsXML();
                    if (installedVersion < remoteVersion)
                    {
                        if (BOX.ShowQuestion("You have old version of application."
                                             + Environment.NewLine +
                                             "Would you like install the new version?", "Update") == true)
                        {
                            Process.Start(System.IO.Path.Combine(pathToFolder, "Updater.exe"));
                            Environment.Exit(0);
                        }
                    }
                }
            }
        }
 private void CloseT(object sender, RoutedEventArgs e)
 {
     if (BOX.ShowQuestion("Do you realy want to close Application ?", "Exit") == true)
     {
         this.WindowState            = WindowState.Maximized;
         Settings1.Default.ReadMess += CounterMessages.ReadedNowSess;
         Settings1.Default.Save();
         Environment.Exit(0);
     }
 }
示例#3
0
 private void exit(EventArgs e)
 {
     if (BOX.ShowQuestion("Are you wishct to exit now?", "Custodian") == MessageBoxResult.Yes)
     {
         Storage.datasetAdmin.Tables.Clear();
         MainWindow M = new MainWindow();
         this.Hide();
         M.Show();
         adminDAL.EndSession();
     }
 }