Ejemplo n.º 1
0
        private async void SaveAndConnectClick(object sender, RoutedEventArgs e)
        {
            var conn = (CollectionControl.SelectedItem as ChatServerConnection);

            if (conn != null)
            {
                try
                {
                    if (!conn.IsValid())
                    {
                        MessageBox.Show("The connection details are invalid. Please correct them and try again.", "Oops!");
                        return;
                    }
                    var done = await StudioContext.LoadFromChatServerConnectionAsync(conn);

                    if (!done)
                    {
                        return;
                    }
                    if (Save())
                    {
                        HideConfirm = true;
                        Close();
                    }
                }
                catch (Exception ex)
                {
                    StudioContext.Current = null;
                    MessageBox.Show("Unable to connect to the chat server");
                }
            }
        }