public NewConnectionWindow(ClientHandle handle, RecentWorld recentWorld, bool isDebug)
        {
            this._recentWorld = recentWorld;
            this._isDebug = isDebug;
            this.InitializeComponent();

            this._handle = handle;
            this._handle.ReceiveClose += this._handle_ReceiveClose;

            this.Closed += this.NewConnectionWindow_Closed;

            foreach (Profile profile in SettingsManager.Settings.Profiles.OrderBy(v => v.Id))
            {
                var item = new TextBlock(new Run(profile.Name.GetVisualName())) {Tag = profile};
                this.ProfileComboBox.Items.Add(item);

                if (recentWorld.Profile == profile.Id)
                    this.ProfileComboBox.SelectedItem = item;
            }

            foreach (Account account in SettingsManager.Settings.Accounts.OrderBy(v => v.Id))
            {
                var item = new TextBlock(new Run((account.Name ?? account.Email).GetVisualName())) {Tag = account};
                this.AccountComboBox.Items.Add(item);

                if (recentWorld.Account == account.Id)
                    this.AccountComboBox.SelectedItem = item;
            }

            this.WorldIdTextBox.Text = recentWorld.WorldId;
        }
Example #2
0
        private void ShowRename(RecentWorld recent)
        {
            var rename = new RenameWindow {Owner = this, NameTextBox = {Text = recent.Name}};
            if (rename.ShowDialog() == true)
            {
                recent.Name = rename.NameTextBox.Text;
            }

            SettingsManager.Save();
            this.RefreshRecent();
        }
Example #3
0
 private void SetIncoming(RecentWorld recent)
 {
     this.IncomingSettings = recent;
 }
Example #4
0
 private void RemoveRecent(RecentWorld recent)
 {
     SettingsManager.Settings.RecentWorlds.Remove(recent);
     SettingsManager.Save();
     this.RefreshRecent();
 }
Example #5
0
        private void AddRecent(RecentWorld recent)
        {
            // If there is an unnamed connection with the same world id, remove it to avoid duplicates
            RecentWorld old = SettingsManager.Settings.RecentWorlds.FirstOrDefault(
                v => v.WorldId == recent.WorldId);
            if (old != null)
            {
                SettingsManager.Settings.RecentWorlds.Remove(old);
            }

            SettingsManager.Settings.RecentWorlds.Add(recent);
        }