public ChannelListDialog(Server server) { this.ClientSize = new Size(600, 400); this.Resizable = true; this.Title = "Channel List"; grid = new GridView { AllowMultipleSelection = false }; grid.MouseDoubleClick += HandleMouseDoubleClick; grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("Name"), HeaderText = "Channel", Width = 150, AutoSize = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("UserCount"), HeaderText = "Users", Width = 60, AutoSize = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("Topic"), HeaderText = "Topic", Width = 350, AutoSize = false }); var layout = new DynamicLayout(this); layout.Add(grid, yscale: true); layout.BeginVertical(); layout.AddRow(null, this.CancelButton(), this.OkButton("Join Channel", CanJoin)); layout.EndVertical(); var channelTask = server.GetChannelList(); channelTask.ContinueWith(task => { Application.Instance.AsyncInvoke(delegate { grid.DataStore = new GridItemCollection(task.Result.OrderBy(r => r.Name).OrderByDescending(r => r.UserCount)); }); }, System.Threading.Tasks.TaskContinuationOptions.OnlyOnRanToCompletion); }
public ServerDialog(Server server, bool isNew, bool allowConnect) { this.allowConnect = allowConnect && !isNew; this.Server = server; this.Title = "Add Server"; this.MinimumSize = new Size(300, 0); this.DataContext = server; var layout = new DynamicLayout(); layout.BeginVertical(); layout.AddRow(new Label { Text = "Server Name"}, ServerName()); // generate server-specific edit controls server.GenerateEditControls(layout, isNew); layout.AddRow(null, AutoConnectButton()); layout.EndBeginVertical(); layout.AddRow(Connect(), Disconnect(), null, cancelButton = this.CancelButton(), this.OkButton("Save", () => SaveData())); layout.EndVertical(); Content = layout; SetVisibility(); }
public ChannelListDialog(Server server) { this.ClientSize = new Size(600, 400); this.Resizable = true; this.Title = "Channel List"; this.server = server; grid = new GridView { AllowMultipleSelection = false }; grid.MouseDoubleClick += HandleMouseDoubleClick; grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("Name"), HeaderText = "Channel", Width = 150, AutoSize = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("UserCount"), HeaderText = "Users", Width = 60, AutoSize = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("Topic"), HeaderText = "Topic", Width = 350, AutoSize = false }); var layout = new DynamicLayout(); layout.Add(grid, yscale: true); layout.BeginVertical(); layout.AddRow(null, this.CancelButton(), this.OkButton("Join Channel", CanJoin)); layout.EndVertical(); Content = layout; }
void RemoveSection(Server server, ITreeItem item) { var generator = item as ISectionGenerator; if (generator != null) { var key = new Tuple<Server, string>(server, item.Key); if (sectionCache.ContainsKey(key)) { sectionCache.Remove(key); } } }
void UnRegister(Server server) { server.Disconnecting -= HandleDisconnecting; server.Disconnected -= HandleDisconnected; server.Connected -= HandleConnected; server.ConnectError -= HandleConnectError; server.OpenChannel -= HandleOpenChannel; server.CloseChannel -= HandleCloseChannel; server.ChannelInfoChanged -= HandleChannelInfoChanged; }
void Register(Server server) { server.Connected += HandleConnected; server.ConnectError += HandleConnectError; server.Disconnected += HandleDisconnected; server.Disconnecting += HandleDisconnecting; server.OpenChannel += HandleOpenChannel; server.CloseChannel += HandleCloseChannel; server.ChannelInfoChanged += HandleChannelInfoChanged; CreateSection(server, server); }
public void HookServer(Server server) { DisconnectCount++; if (Finished != null) server.Disconnected += Disconnected; }
Control CreateSection(Server server, ITreeItem item) { var generator = item as ISectionGenerator; Control section = null; if (generator != null) { var key = new Tuple<Server, string>(server, item.Key); if (!sectionCache.TryGetValue(key, out section)) { section = generator.GenerateSection(); sectionCache.Add(key, section); } } return section; }
public User(Server server) { this.Server = Server; }
public ChannelInfo(Server server) { this.Server = server; }
public ConnectionErrorEventArgs(Server server, Exception exception) { this.Server = server; this.Exception = exception; }
public Channel(Server server) { this.Id = Guid.NewGuid().ToString(); this.Server = server; }
public ServerSection(Server server) { this.Server = server; this.Server.GlobalMessageReceived += HandleGlobalMessageReceived; }
public User(Server server) { Server = server; }
public ServerEventArgs(Server server) { this.Server = server; }
void RemoveSections(Server server) { var serverSection = GetServerSection(server); var items = sectionCache.Where(r => r.Key.Item1 == server && r.Value != serverSection).Select(r => r.Key).ToArray(); foreach (var item in items) { sectionCache.Remove(item); } }
MessageSection GetServerSection(Server server) { if (server == null) return null; return CreateSection(server, server) as MessageSection; }
public void RemoveServer(Server server) { if (server.IsConnected) server.Disconnect(); server.ClearPasswords(); servers.Remove(server); OnServerRemoved(new ServerEventArgs(server)); }
public void JoinChannel(Server server, string name) { var channel = server.Channels.FirstOrDefault(r => r.Name == name); if (channel != null) channelList.SelectedItem = channel; else { server.JoinChannel(name); } }
public void AddServer(Server server) { servers.Add(server); OnServerAdded(new ServerEventArgs(server)); }