Esempio n. 1
0
 protected override void GivenOverride()
 {
     /*force it to go into confirmed state*/
     ServerDialog.SetLastResponse(CreateRingingResponse());
     ServerDialog.SetLastResponse(CreateOkResponse());
     ServerDialog.State.Should().Be(DialogState.Confirmed); /*required assertion*/
 }
Esempio n. 2
0
        public override void OnExecuted(EventArgs e)
        {
            base.OnExecuted(e);
            var server = new JabbRServer {
                Name = "JabbR.net", Address = "https://jabbr.net", JanrainAppName = "jabbr"
            };

            using (var dialog = new ServerDialog(server, true, true))
            {
                dialog.DisplayMode = DialogDisplayMode.Attached;
                var ret = dialog.ShowDialog(Application.Instance.MainForm);
                if (ret == DialogResult.Ok)
                {
                    Debug.WriteLine("Added Server, Name: {0}", server.Name);
                    var config = JabbRApplication.Instance.Configuration;
                    config.AddServer(server);
                    JabbRApplication.Instance.SaveConfiguration();
                    if (AutoConnect)
                    {
                        Application.Instance.AsyncInvoke(delegate
                        {
                            server.Connect();
                        });
                    }
                }
            }
        }
Esempio n. 3
0
 protected override void When()
 {
     /*force it to go into early state*/
     _ringingResponse = CreateRingingResponse();
     ServerDialog.SetLastResponse(_ringingResponse);
     ServerDialog.State.Should().Be(DialogState.Early); /*required assertion*/
 }
Esempio n. 4
0
 protected override void When()
 {
     try
     {
         var okResponse = CreateOkResponse();
         ServerDialog.SetLastResponse(okResponse);
     }
     catch (Exception)
     {
         _thrown = true;
     }
 }
 /// <summary>
 /// 打开服务器IP设置框
 /// </summary>
 private async void ExecuteServerDialog()
 {
     try
     {
         var view = new ServerDialog();
         ServerDialogViewModel = new ServerDialogViewModel();
         //show the dialog
         await DialogHost.Show(view, "RootDialog", ConfirSaveServerHandler);
     }
     catch (Exception ex)
     {
         ErrorDialogViewModel.getInstance().show(ex);
         return;
     }
 }
Esempio n. 6
0
        private void EnableServer(object obj)
        {
            var dialog = new ServerDialog();

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            try
            {
                var excludedPlugins = Settings.Current.Plugins
                                      .Where(s => !s.Enabled)
                                      .Select(s => s.Name)
                                      .ToArray();

                var initializer = new ServerInitializer
                {
                    AdminPassword   = Settings.Current.AdminPassword,
                    PluginsPath     = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins"),
                    ExcludedPlugins = excludedPlugins
                };

                ServerModel.Init(initializer);
                ServerModel.Server.Start(Settings.Current.Port, Settings.Current.ServicePort, Settings.Current.StateOfIPv6Protocol);

                InitializeClient(true);
            }
            catch (ArgumentException)
            {
                SelectedRoom.AddSystemMessage(Localizer.Instance.Localize(ParamsErrorKey));

                if (ClientModel.IsInited)
                {
                    ClientModel.Reset();
                }

                if (ServerModel.IsInited)
                {
                    ServerModel.Reset();
                }
            }
        }
Esempio n. 7
0
        public override void OnExecuted(EventArgs e)
        {
            base.OnExecuted(e);
            var server = channels.SelectedServer;

            if (server != null)
            {
                using (var dialog = new ServerDialog(server, false, true))
                {
                    dialog.DisplayMode = DialogDisplayMode.Attached;
                    var ret = dialog.ShowDialog(Application.Instance.MainForm);
                    if (ret == DialogResult.Ok)
                    {
                        JabbRApplication.Instance.SaveConfiguration();
                        Debug.WriteLine(string.Format("Edited Server, Name: {0}", server.Name));
                    }
                }
            }
        }
Esempio n. 8
0
        private void EnableServer(object obj)
        {
            var dialog = new ServerDialog();

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    var adminPassword   = Settings.Current.AdminPassword;
                    var p2pPort         = Settings.Current.ServerStartP2PPort;
                    var excludedPlugins = Settings.Current.Plugins
                                          .Where(s => !s.Enabled)
                                          .Select(s => s.Name)
                                          .ToArray();

                    var initializer = new ServerInitializer
                    {
                        AdminPassword   = adminPassword,
                        PluginsPath     = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, PluginsDirectoryName),
                        ExcludedPlugins = excludedPlugins,
                        Certificate     = new X509Certificate2(dialog.CertificatePath, dialog.CertificatePassword),
                    };

                    ServerModel.Init(initializer);

                    var serverStartUri = Connection.CreateTcpchatUri(dialog.ServerAddress);
                    ServerModel.Server.Start(serverStartUri, p2pPort);

                    dialog.SaveSettings();
                }
                catch (Exception e)
                {
                    var errorMessage = Localizer.Instance.Localize(ParamsErrorKey);
                    SelectedRoom.AddSystemMessage($"{errorMessage}\r\n{e.Message}");

                    if (ServerModel.IsInited)
                    {
                        ServerModel.Reset();
                    }
                }
            }
        }
Esempio n. 9
0
 public override bool Authenticate(Control parent)
 {
     if (UseSocialLogin)
     {
         var dlg    = new JabbRAuthDialog(Address, JanrainAppName);
         var result = dlg.ShowDialog(parent);
         if (result == DialogResult.Ok)
         {
             UserId = dlg.UserID;
             return(true);
         }
     }
     else
     {
         var dialog = new ServerDialog(this, false, false);
         dialog.DisplayMode = DialogDisplayMode.Attached;
         var ret = dialog.ShowDialog(Application.Instance.MainForm);
         return(ret == DialogResult.Ok);
     }
     return(false);
 }
        protected override void When()
        {
            var ringingResponse = CreateRingingResponse();

            ServerDialog.SetLastResponse(ringingResponse);
        }
Esempio n. 11
0
 protected override void When()
 {
     _okResponse = CreateOkResponse();
     ServerDialog.SetLastResponse(_okResponse);
 }
Esempio n. 12
0
 public void Expect_the_dialog_to_be_in_the_DialogTable()
 {
     DialogTable.ContainsKey(ServerDialog.GetId()).Should().BeTrue();
 }
Esempio n. 13
0
 protected override void When()
 {
     _busyHereResponse = CreateBusyHereResponse();
     ServerDialog.SetLastResponse(_busyHereResponse);
 }