コード例 #1
0
        public virtual void Add()
        {
            Trace.Call();

            var dialog = new ServerDialog(_Parent, null,
                                          Frontend.Session.GetSupportedProtocols(),
                                          _Controller.GetNetworks());

            try {
                int         res    = dialog.Run();
                ServerModel server = dialog.GetServer();
                if (res != (int)Gtk.ResponseType.Ok)
                {
                    return;
                }

                _Controller.AddServer(server);
                _Controller.Save();

                // refresh view
                Load();
            } finally {
                dialog.Destroy();
            }
        }
コード例 #2
0
        public virtual void Edit(ServerModel server)
        {
            Trace.Call(server);

            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            var dialog = new ServerDialog(_Parent, server,
                                          Frontend.Session.GetSupportedProtocols(),
                                          _Controller.GetNetworks());
            int res = dialog.Run();

            server = dialog.GetServer();
            dialog.Destroy();
            if (res != (int)Gtk.ResponseType.Ok)
            {
                return;
            }

            _Controller.SetServer(server);
            _Controller.Save();

            // refresh the view
            Load();
        }
コード例 #3
0
        protected void OnAddServerActionActivated(object sender, EventArgs e)
        {
            Trace.Call(sender, e);

            ServerDialog dialog = null;

            try {
                var controller = new ServerListController(Frontend.UserConfig);
                dialog = new ServerDialog(Parent, null,
                                          Frontend.Session.GetSupportedProtocols(),
                                          controller.GetNetworks());
                int         res    = dialog.Run();
                ServerModel server = dialog.GetServer();
                if (res != (int)Gtk.ResponseType.Ok)
                {
                    return;
                }

                controller.AddServer(server);
                controller.Save();

                // reload server list in join bar
                JoinWidget.InitNetworks(controller.GetNetworks());
            } catch (InvalidOperationException ex) {
                Frontend.ShowError(Parent, _("Unable to add server: "), ex);
            } catch (Exception ex) {
                Frontend.ShowException(Parent, ex);
            } finally {
                if (dialog != null)
                {
                    dialog.Destroy();
                }
            }
        }
コード例 #4
0
ファイル: MainWindow.cs プロジェクト: licnep/smuxi
        protected virtual void OnServerAddButtonClicked(object sender, EventArgs e)
        {
            Trace.Call(sender, e);

            ServerDialog dialog = null;

            try {
                ServerListController controller = new ServerListController(Frontend.UserConfig);
                dialog = new ServerDialog(this, null,
                                          Frontend.Session.GetSupportedProtocols(),
                                          controller.GetNetworks());
                int         res    = dialog.Run();
                ServerModel server = dialog.GetServer();
                if (res != (int)Gtk.ResponseType.Ok)
                {
                    return;
                }

                controller.AddServer(server);
                controller.Save();
            } catch (InvalidOperationException ex) {
                Frontend.ShowError(this, _("Unable to add server: "), ex);
            } catch (Exception ex) {
                Frontend.ShowException(this, ex);
            } finally {
                if (dialog != null)
                {
                    dialog.Destroy();
                }
            }
        }
コード例 #5
0
ファイル: MenuWidget.cs プロジェクト: vith/smuxi
        protected void OnAddServerActionActivated(object sender, EventArgs e)
        {
            Trace.Call(sender, e);

            ServerDialog dialog = null;
            try {
                var controller = new ServerListController(Frontend.UserConfig);
                dialog = new ServerDialog(Parent, null,
                                          Frontend.Session.GetSupportedProtocols(),
                                          controller.GetNetworks());
                int res = dialog.Run();
                ServerModel server = dialog.GetServer();
                if (res != (int) Gtk.ResponseType.Ok) {
                    return;
                }

                controller.AddServer(server);
                controller.Save();
            } catch (InvalidOperationException ex) {
                Frontend.ShowError(Parent, _("Unable to add server: "), ex);
            } catch (Exception ex) {
                Frontend.ShowException(Parent, ex);
            } finally {
                if (dialog != null) {
                    dialog.Destroy();
                }
            }
        }
コード例 #6
0
ファイル: ServerListView.cs プロジェクト: grendello/smuxi
        public virtual void Add()
        {
            Trace.Call();

            ServerDialog dialog = new ServerDialog(_Parent, null, Frontend.Session.GetSupportedProtocols(), _Controller.GetNetworks());
            try {
                int res = dialog.Run();
                ServerModel server = dialog.GetServer();
                if (res != (int) Gtk.ResponseType.Ok) {
                    return;
                }

                _Controller.AddServer(server);
                _Controller.Save();

                // refresh view
                Load();
            } finally {
                dialog.Destroy();
            }
        }
コード例 #7
0
ファイル: ServerListView.cs プロジェクト: grendello/smuxi
        public virtual void Edit(ServerModel server)
        {
            Trace.Call(server);

            if (server == null) {
                throw new ArgumentNullException("server");
            }

            ServerDialog dialog = new ServerDialog(_Parent, server, Frontend.Session.GetSupportedProtocols(), _Controller.GetNetworks());
            int res = dialog.Run();
            server = dialog.GetServer();
            dialog.Destroy();
            if (res != (int) Gtk.ResponseType.Ok) {
                return;
            }

            _Controller.SetServer(server);
            _Controller.Save();

            // refresh the view
            Load();
        }