Exemplo n.º 1
1
		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);
		}
Exemplo n.º 2
0
		public ServerDialog (Server server, bool isNew, bool allowConnect)
		{
			this.isNew = isNew;
			this.allowConnect = allowConnect && !isNew;
			this.Server = server;
			this.Title = "Add Server";
			this.MinimumSize = new Size (300, 0);
			this.DataContext = server;
			
			var layout = new DynamicLayout (this);
			
			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 ();
			
			SetVisibility ();
		}
Exemplo n.º 3
0
 public void HookServer(Server server)
 {
     DisconnectCount++;
     if (Finished != null)
         server.Disconnected += Disconnected;
 }
Exemplo n.º 4
0
 public void AddServer(Server server)
 {
     servers.Add(server);
     OnServerAdded(new ServerEventArgs(server));
 }
Exemplo n.º 5
0
 public void RemoveServer(Server server)
 {
     if (server.IsConnected)
         server.Disconnect();
     server.ClearPasswords();
     servers.Remove(server);
     OnServerRemoved(new ServerEventArgs(server));
 }
Exemplo n.º 6
0
 public ChannelInfo(Server server)
 {
     this.Server = server;
 }
Exemplo n.º 7
0
 public ServerSection(Server server)
 {
     this.Server = server;
     this.Server.GlobalMessageReceived += HandleGlobalMessageReceived;
 }
Exemplo n.º 8
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);
			}
		}
Exemplo n.º 9
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);
         }
     }
 }
Exemplo n.º 10
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;
		}
Exemplo n.º 11
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);
		}
Exemplo n.º 12
0
 public ConnectionErrorEventArgs(Server server, Exception exception)
 {
     this.Server = server;
     this.Exception = exception;
 }
Exemplo n.º 13
0
 public ServerEventArgs(Server server)
 {
     this.Server = server;
 }
Exemplo n.º 14
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;
 }
Exemplo n.º 15
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);
     }
 }
Exemplo n.º 16
0
		public Channel (Server server)
		{
			this.Id = Guid.NewGuid ().ToString ();
			this.Server = server;
		}
Exemplo n.º 17
0
		MessageSection GetServerSection (Server server)
		{
			if (server == null) return null;
			return CreateSection (server) as MessageSection;
		}
Exemplo n.º 18
0
 public User(Server server)
 {
     this.Server = Server;
 }