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);
 }
示例#2
0
        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;
        }
示例#4
0
 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);
         }
     }
 }
示例#5
0
 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;
 }
示例#6
0
 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;
 }
示例#8
0
 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;
 }
示例#9
0
 public User(Server server)
 {
     this.Server = Server;
 }
示例#10
0
 public ChannelInfo(Server server)
 {
     this.Server = server;
 }
 public ConnectionErrorEventArgs(Server server, Exception exception)
 {
     this.Server = server;
     this.Exception = exception;
 }
示例#12
0
 public Channel(Server server)
 {
     this.Id = Guid.NewGuid().ToString();
     this.Server = server;
 }
示例#13
0
 public ServerSection(Server server)
 {
     this.Server = server;
     this.Server.GlobalMessageReceived += HandleGlobalMessageReceived;
 }
示例#14
0
 public User(Server server)
 {
     Server = server;
 }
示例#15
0
 public ServerEventArgs(Server server)
 {
     this.Server = server;
 }
示例#16
0
 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);
     }
 }
示例#17
0
 MessageSection GetServerSection(Server server)
 {
     if (server == null)
         return null;
     return CreateSection(server, server) as MessageSection;
 }
示例#18
0
 public void RemoveServer(Server server)
 {
     if (server.IsConnected)
         server.Disconnect();
     server.ClearPasswords();
     servers.Remove(server);
     OnServerRemoved(new ServerEventArgs(server));
 }
示例#19
0
 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);
     }
 }
示例#20
0
 public void AddServer(Server server)
 {
     servers.Add(server);
     OnServerAdded(new ServerEventArgs(server));
 }