public static void DisconnectEngineFromGUI() { Trace.Call(); try { // sync tab positions if (!IsLocalEngine && !UseLowBandwidthMode) { _MainWindow.Notebook.SyncPagePositions(); } if (_FrontendManager != null) { _FrontendManager.IsFrontendDisconnecting = true; } if (_Session != null) { _Session.DeregisterFrontendUI(_MainWindow.UI); } } catch (System.Net.Sockets.SocketException) { // ignore as the connection is maybe already broken } catch (System.Runtime.Remoting.RemotingException) { // ignore as the connection is maybe already broken } _MainWindow.Hide(); _MainWindow.ChatViewManager.Clear(); // make sure no stray SSH tunnel leaves behind _MainWindow.EngineManager.Disconnect(); _FrontendManager = null; Session = null; }
internal override void OnThreadAttached() { _frontendMgr = ScriptThread.GetOrCreate <FrontendManager>(); _frontendMgr.Events["textadded"] += OnInputEvent; base.OnThreadAttached(); }
public static void DisconnectEngineFromGUI() { _FrontendManager.IsFrontendDisconnecting = true; //_Session.DeregisterFrontendUI(_MainWindow.UI); //_MainWindow.Hide(); //_MainWindow.Notebook.RemoveAllPages(); _FrontendManager = null; _Session = null; }
public static void ConnectEngineToGUI() { _FrontendManager = _Session.GetFrontendManager(_MainWindow.UI); _FrontendManager.Sync(); if (_UserConfig.IsCaching) { // when our UserConfig is cached, we need to invalidate the cache _FrontendManager.ConfigChangedDelegate = new SimpleDelegate(_UserConfig.ClearCache); } // make sure entry got attention :-P // BUG: MonoCurses //_MainWindow.Entry.HasFocus = true; }
public static void ConnectEngineToGUI() { _FrontendManager = _Session.GetFrontendManager(_MainWindow.UI); _FrontendManager.Sync(); if (_UserConfig.IsCaching) { // when our UserConfig is cached, we need to invalidate the cache _FrontendManager.ConfigChangedDelegate = new SimpleDelegate(_UserConfig.ClearCache); } _MainWindow.Show(); _MainWindow.ApplyConfig(_UserConfig); // make sure entry got attention :-P _MainWindow.Entry.Select(); }
public static void DisconnectEngineFromGUI(bool cleanly) { Trace.Call(cleanly); IsDisconnecting = true; MainWindow.ChatViewManager.IsSensitive = false; if (cleanly) { try { // sync tab positions if (!IsLocalEngine && !UseLowBandwidthMode) { _MainWindow.Notebook.SyncPagePositions(); } if (_FrontendManager != null) { _FrontendManager.IsFrontendDisconnecting = true; } if (_Session != null) { _Session.DeregisterFrontendUI(_MainWindow.UI); } } catch (System.Net.Sockets.SocketException) { // ignore as the connection is maybe already broken } catch (System.Runtime.Remoting.RemotingException) { // ignore as the connection is maybe already broken } } if (_FrontendManagerCheckerQueue != null) { _FrontendManagerCheckerQueue.Dispose(); } _MainWindow.ChatViewManager.Clear(); _MainWindow.UpdateProgressBar(); // make sure no stray SSH tunnel leaves behind _MainWindow.EngineManager.Disconnect(); _MainWindow.NetworkStatus = null; _MainWindow.Status = _("Disconnected from engine."); _FrontendManager = null; Session = null; IsDisconnecting = false; }
public override void Update() { if ((this.m_worldsListWidget.SelectedItem != null) && (WorldsManager.WorldInfos.IndexOf((WorldInfo)this.m_worldsListWidget.SelectedItem) < 0)) { this.m_worldsListWidget.SelectedItem = null; } object[] objArray1 = new object[] { (int)this.m_worldsListWidget.Items.Count }; base.ScreenWidget.Children.Find <LabelWidget>("TopBar.Label", true).Text = string.Format("Existing Worlds ({0})", (object[])objArray1); base.ScreenWidget.Children.Find("Play", true).IsEnabled = (this.m_worldsListWidget.SelectedItem != null); base.ScreenWidget.Children.Find("Properties", true).IsEnabled = (this.m_worldsListWidget.SelectedItem != null); if (base.ScreenWidget.Children.Find <ButtonWidget>("Play", true).IsClicked&& (this.m_worldsListWidget.SelectedItem != null)) { FrontendManager.StartFadeOutIn(delegate { object[] parameters = new object[2]; parameters[0] = this.m_worldsListWidget.SelectedItem; ScreensManager.SwitchScreen("GameLoading", parameters); this.m_worldsListWidget.SelectedItem = null; }); } if (base.ScreenWidget.Children.Find <ButtonWidget>("NewWorld", true).IsClicked) { FrontendManager.StartFadeOutIn(delegate { ScreensManager.SwitchScreen("NewWorld", new object[0]); this.m_worldsListWidget.SelectedItem = null; }); } if (base.ScreenWidget.Children.Find <ButtonWidget>("Properties", true).IsClicked&& (this.m_worldsListWidget.SelectedItem != null)) { FrontendManager.StartFadeOutIn(delegate { object[] parameters = new object[] { this.m_worldsListWidget.SelectedItem }; ScreensManager.SwitchScreen("ModifyWorld", parameters); }); } if (InputManager.InputState.Back || base.ScreenWidget.Children.Find <ButtonWidget>("TopBar.Back", true).IsClicked) { FrontendManager.StartFadeOutIn(delegate { ScreensManager.SwitchScreen("MainMenu", new object[0]); this.m_worldsListWidget.SelectedItem = null; }); } }
public void ConnectEngineToGUI() { FrontendManager = Session.GetFrontendManager(MainWindow.UI); FrontendManager.Sync(); if (UserConfig.IsCaching) { // when our UserConfig is cached, we need to invalidate the cache FrontendManager.ConfigChangedDelegate = new SimpleDelegate(UserConfig.ClearCache); } MainWindow.Show(); MainWindow.ApplyConfig(UserConfig); // make sure entry got attention :-P MainWindow.Entry.Focus(); }
private void _CommandWindow(CommandModel cd) { FrontendManager fm = cd.FrontendManager; if (cd.DataArray.Length >= 2) { var currentChat = ChatViewManager.CurrentChatView; if (cd.Parameter.ToLower() == "close") { // FIXME: REMOTING CALL if (cd.Chat.ProtocolManager != null) { cd.Chat.ProtocolManager.CloseChat(fm, cd.Chat); } } else { try { int number = Int32.Parse(cd.DataArray[1]); if (number > ChatViewManager.Chats.Count) { return; } ChatViewManager.CurrentChatNumber = number - 1; return; } catch (FormatException) { } // seems to be query- or channelname // let's see if we find something var seachKey = cd.Parameter.ToLower(); var candidates = new List <ChatView>(); foreach (var chatView in ChatViewManager.Chats) { if (chatView.Name.ToLower() != seachKey) { continue; } // name matches // let's see if there is an exact match, if so, take it // FIXME: REMOTING CALL if ((chatView.GetType() == currentChat.GetType()) && (chatView.ChatModel.ProtocolManager == currentChat.ChatModel.ProtocolManager)) { candidates.Add(chatView); break; } else { // there was no exact match candidates.Add(chatView); } } if (candidates.Count == 0) { return; } ChatViewManager.CurrentChatView = candidates[0]; } } }
public static void Init(string[] args) { System.Threading.Thread.CurrentThread.Name = "Main"; if (!(args.Length >= 1)) { Console.Error.WriteLine("Usage: smuxi-test.exe profile"); Environment.Exit(1); } #if LOG4NET _Logger.Info("smuxi-test starting"); #endif _FrontendConfig = new FrontendConfig("Test"); _FrontendConfig.Load(); string profile = args[0]; if (String.IsNullOrEmpty(profile)) { Console.Error.WriteLine("profile parameter must not be empty!"); Environment.Exit(1); } IFrontendUI ui = new TestUI(); Session session = null; if (profile == "local") { Engine.Engine.Init(); session = new Engine.Session(Engine.Engine.Config, Engine.Engine.ProtocolManagerFactory, "local"); session.RegisterFrontendUI(ui); } else { // remote engine EngineManager engineManager = new EngineManager(_FrontendConfig, ui); engineManager.Connect(profile); session = engineManager.Session; } if (session == null) { Console.Error.WriteLine("Session is null, something went wrong setting up or connecting to the engine!"); Environment.Exit(1); } _Session = session; _UserConfig = session.UserConfig; _FrontendManager = session.GetFrontendManager(ui); _FrontendManager.Sync(); if (_UserConfig.IsCaching) { // when our UserConfig is cached, we need to invalidate the cache _FrontendManager.ConfigChangedDelegate = new SimpleDelegate(_UserConfig.ClearCache); } while (true) { string line = Console.ReadLine(); // TODO: remove the entered line from output //Console.WriteLine(Escape+"M"); _ExecuteCommand(line); } }
public void OpenChat(FrontendManager frontman, ChatModel chat) { }
public static void ConnectEngineToGUI() { if (IsLocalEngine) { // HACK: SessionManager.Register() is not used for local engines _LocalSession.RegisterFrontendUI(_MainWindow.UI); } SyncConfig(); _FrontendManager = _Session.GetFrontendManager(_MainWindow.UI); _FrontendManager.Sync(); // MS .NET doesn't like this with Remoting? if (Type.GetType("Mono.Runtime") != null) { // when are running on Mono, all should be good if (_UserConfig.IsCaching) { // when our UserConfig is cached, we need to invalidate the cache // DISABLED: see FrontendManager._OnConfigChanged //_FrontendManager.ConfigChangedDelegate = SyncConfig; } } _MainWindow.ShowAll(); // make sure entry got attention :-P _MainWindow.Entry.HasFocus = true; // local sessions can't have network issues :) if (_Session != _LocalSession) { _FrontendManagerCheckerQueue = new TaskQueue("FrontendManagerCheckerQueue"); _FrontendManagerCheckerQueue.AbortedEvent += delegate { #if LOG4NET _Logger.Debug("_FrontendManagerCheckerQueue.AbortedEvent(): task queue aborted!"); #endif }; _FrontendManagerCheckerQueue.ExceptionEvent += delegate(object sender, TaskQueueExceptionEventArgs e) { #if LOG4NET _Logger.Error("Exception in TaskQueue: ", e.Exception); _Logger.Error("Inner-Exception: ", e.Exception.InnerException); #endif Frontend.ShowException(e.Exception); }; _FrontendManagerCheckerQueue.Queue(delegate { // keep looping as long as the checker returns true while (CheckFrontendManagerStatus()) { // FIXME: bail out somehow when we lost the connection // without an exception in the meantime // only check once per minute Thread.Sleep(60 * 1000); } #if LOG4NET _Logger.Debug("_FrontendManagerCheckerQueue(): " + "CheckFrontendManagerStatus() returned false, " + "time to say good bye!"); #endif }); } MainWindow.ChatViewManager.IsSensitive = true; }
public void CloseChat(FrontendManager frontman, ChatModel chat) { }
private void _CommandWindow(CommandModel cd) { FrontendManager fm = cd.FrontendManager; if (cd.DataArray.Length >= 2) { ChatModel currentChatModel = _Notebook.CurrentChatView.ChatModel; string name; if (cd.DataArray[1].ToLower() == "close") { name = currentChatModel.Name; // BUG: handle this in GNOME-IRC /* * if (currentChatModel.ChatType != ChatType.Network) { * if (currentChatModel.ProtocolManager is IrcProtocolManager) { * IrcProtocolManager ircm = (IrcProtocolManager) currentChatModel.ProtocolManager; * if (currentChatModel.ChatType == ChatType.Group) { * // channel * ircm.CommandPart(new CommandModel(fm, currentChatModel, name)); * } else { * // query * Frontend.Session.RemoveChat(currentChatModel); * } * } * } */ } else { bool is_number = false; int pagecount = _Notebook.TabCount; try { int number = Int32.Parse(cd.DataArray[1]); is_number = true; if (number <= pagecount) { _Notebook.SelectedIndex = number - 1; } } catch (FormatException) { } if (!is_number) { // seems to be query- or channelname // let's see if we find something ArrayList candidates = new ArrayList(); for (int i = 0; i < pagecount; i++) { ChatView chatView = _Notebook.GetChat(i); ChatModel chatModel = chatView.ChatModel; if (chatModel.Name.ToLower() == cd.DataArray[1].ToLower()) { // name matches // first let's see if there is an exact match, if so, take it if ((chatModel.ChatType == currentChatModel.ChatType) && (chatModel.ProtocolManager == currentChatModel.ProtocolManager)) { _Notebook.SelectedIndex = i; break; } else { // there was no exact match candidates.Add(i); } } } if (candidates.Count > 0) { _Notebook.SelectedIndex = (int)candidates[0]; } } } } }
public override void Update() { if (this.m_loadingFinished) { return; } double realTime = Time.RealTime; while (!this.m_pauseLoading) { if (this.m_index < this.m_loadActions.Count) { try { List <Action> loadActions = this.m_loadActions; int index1 = this.m_index; this.m_index = index1 + 1; int index2 = index1; loadActions[index2](); } catch (Exception ex) { Log.Error("Loading error. Reason: " + ex.Message); if (!this.m_loadingErrorsSuppressed) { this.m_pauseLoading = true; DialogsManager.ShowDialog((Dialog) new MessageDialog("Loading Error", ExceptionManager.MakeFullErrorMessage(ex), "OK", "Suppress", (Action <MessageDialogButton>)(b => { if (b == MessageDialogButton.Button1) { this.m_pauseLoading = false; } else { if (b != MessageDialogButton.Button2) { return; } this.m_loadingErrorsSuppressed = true; } }))); } } if (Time.RealTime - realTime > 0.1) { break; } } else { break; } } if (this.m_index < this.m_loadActions.Count) { return; } this.m_loadingFinished = true; AudioManager.PlaySound("Audio/UI/ButtonClick", 1f, 0.0f, 0.0f); FrontendManager.StartFadeOutIn((Action)(() => ScreensManager.SwitchScreen("MainMenu"))); }
public void Connect(FrontendManager frontman, ServerModel srv) { }
public void Reconnect(FrontendManager frontman) { }