private void buttonBrowseSteamInstallDir_Click(object sender, RoutedEventArgs e)
        {
            string installDir = UserInteraction.selectSteamDirectory(@"C:\Program Files (x86)\Steam");

            if (installDir != null)
            {
                _windowSettings.SteamInstallDir = installDir;
                textSteamInstallDir.Text        = _windowSettings.SteamInstallDir;
                MadeChange();
            }
        }
        private void buttonBrowseSteamInstallDir_Click(object sender, RoutedEventArgs e)
        {
            string installDir = UserInteraction.selectSteamDirectory(@"C:\Program Files (x86)\Steam");

            if (installDir != null)
            {
                Properties.Settings.Default.steamInstallDir = installDir;
                changedSteam             = new Steam(installDir);
                textSteamInstallDir.Text = Properties.Settings.Default.steamInstallDir;
            }
        }
 private void askUserForSteamLocation()
 {
     //No steam directory in Settings, let's find 'em!
     if (Properties.Settings.Default.steamInstallDir == String.Empty)
     {
         //Run this on first start
         string installDir = UserInteraction.selectSteamDirectory(@"C:\Program Files (x86)\Steam");
         if (installDir == null)
         {
             MessageBox.Show(
                 "You cannot use SteamAccountSwitcher without selecting your Steam.exe. Program will close now.",
                 "Steam missing", MessageBoxButton.OK, MessageBoxImage.Error);
             Close();
         }
         else
         {
             SasManager.Instance.SetSteamInstallDir(installDir);
         }
     }
 }
        public MainWindow()
        {
            AutoUpdater.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); //Workaround for horrible AutoUpdater translations :D
            AutoUpdater.Start("http://wedenig.org/SteamAccountSwitcher/version.xml");

            InitializeComponent();
            //statusBarLabel.Content = AppDomain.CurrentDomain.BaseDirectory; //Debug location

            //Restore size
            this.Top    = Properties.Settings.Default.Top;
            this.Left   = Properties.Settings.Default.Left;
            this.Height = Properties.Settings.Default.Height;
            this.Width  = Properties.Settings.Default.Width;

            if (Properties.Settings.Default.Maximized)
            {
                WindowState = WindowState.Maximized;
            }

            fixOutOfBoundsWindow();

            //No steam directory in Settings, let's find 'em!
            if (Properties.Settings.Default.steamInstallDir == String.Empty)
            {
                //Run this on first start
                string installDir = UserInteraction.selectSteamDirectory(@"C:\Program Files (x86)\Steam");
                if (installDir == null)
                {
                    MessageBox.Show("You cannot use SteamAccountSwitcher without selecting your Steam.exe. Program will close now.", "Steam missing", MessageBoxButton.OK, MessageBoxImage.Error);
                    Close();
                }
                else
                {
                    Properties.Settings.Default.steamInstallDir = installDir;
                    steam = new Steam(installDir);
                }
            }
            else
            {
                //Start steam from existing installation path
                steam = new Steam(Properties.Settings.Default.steamInstallDir);
            }

            //statusBarLabel.Content = "Steam running in '" + Properties.Settings.Default.steamInstallDir + "'";
            statusBarLabel.Content = SteamStatus.steamStatusMessage();
            statusbar.Background   = SteamStatus.getStatusColor();

            loader = new AccountLoader(Encryption.Basic);

            //accountList = new ObservableCollection<SteamAccount>(loader.LoadBasicAccounts());
            if (loader.AccountFileExists())
            {
                //Try to get accounts
                try
                {
                    accountList = new ObservableCollection <SteamAccount>(loader.LoadBasicAccounts());
                }
                catch
                {
                    MessageBox.Show("Account file is currupted or wrong encryption method is set. Check Settings and try again. AutoSave has been disabled so that nothing can be overwritten! Make sure to restart the applications after switching Encryption method!", "Error parsing file", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    accountList      = new ObservableCollection <SteamAccount>();
                    autosaveAccounts = false;
                }
            }
            else
            {
                accountList = new ObservableCollection <SteamAccount>();
            }

            SteamAccount sa = new SteamAccount("username", "testpw");

            sa.Name = "profile name";
            //accountList.Add(sa);

            listBoxAccounts.ItemsSource = accountList;
            listBoxAccounts.Items.Refresh();

            Style itemContainerStyle = new Style(typeof(ListBoxItem));

            //take full width
            itemContainerStyle.Setters.Add(new Setter(HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));
            listBoxAccounts.ItemContainerStyle = itemContainerStyle;
        }