public static Channel FromCode(string ownerName, string channelNumber, string title, string topic, string password) { ChannelProxy proxy = new ChannelProxy(); proxy.SetChannelInfo(channelNumber, title, topic, password, ownerName); return(proxy); }
protected IChannelProxy CreateProxy(IEndPoint endpoint) { IChannelProxy proxy = null; if (!endpoint.Initialized) { proxy = ConfigureEndpoint(endpoint); endpoint.Initialized = true; } else { proxy = new ChannelProxy(GetModel(), _connectionManager.Protocol, endpoint.EndpointConfiguration); } return proxy; }
private void ProxyOpenCommand_Execute() { if (IsOpen) { ChannelProxy.Close(); IsOpen = false; } else { try { ChannelProxy.SetChannel(OwnerChannel != null ? OwnerChannel.Channel : null); ChannelProxy.Open(); IsOpen = true; } catch { MessageBox.Show((string)Manager <LanguageCultureInfo> .StaticInstance.GetResource("#InvaliseParrentChannelError"), (string)Manager <LanguageCultureInfo> .StaticInstance.GetResource("#ErrorMsgBoxTitle"), MessageBoxButton.OK, MessageBoxImage.Warning); return; } } }
public Channel DeSerialize(byte[] ob) { Channel result = null; PacketReader reader = new PacketReader(ob); try { ushort channelNumberLength = reader.ReadUInt16(); int chanNum = -1; if (int.TryParse(reader.ReadString(channelNumberLength), out chanNum)) { result = new ChannelProxy(); result.ChannelNumber = chanNum.ToString(); ushort channelTitleLength = reader.ReadUInt16(); string channelTitle = reader.ReadString(channelTitleLength); result.ChannelTitle = ChannelTitle; ushort publicStateLength = reader.ReadUInt16(); string isPublic = reader.ReadString(publicStateLength); if (isPublic.ToLower() == "yes") { result.IsPublic = true; } else { result.IsPublic = false; } ushort channelModeratorLength = reader.ReadUInt16(); string channelModerator = reader.ReadString(channelModeratorLength); result.Moderator = channelModerator; // How many players on the channel ? ushort playersOnChannelLength = reader.ReadUInt16(); string playersOnChannel = reader.ReadString(playersOnChannelLength); // Somehow i need to get these accounts } } catch (Exception e) { logger.WriteException(e); } return(result); }
public TChannel GetService <TChannel>(ChannelProxy <TChannel> proxy, CancellationToken cancellationToken = default(CancellationToken)) where TChannel : class { var factory = GetFactory <TChannel>(); if (proxy == null) { proxy = new ChannelProxyFactory <TChannel, ChannelProxy <TChannel> >().GetProxy(); } TChannel channel = null; bool wrap = true; using (var scope = new ChannelCreationScope(proxy)) { channel = factory.GetChannel(cancellationToken); wrap = !scope.DisableProxyWrapping; } if (wrap) { ((IDynamicProxy)proxy).SetProxyTarget <TChannel>(channel); return(proxy as TChannel); } return(channel); }
public override string ToString() { return(ChannelProxy.ToString()); }
public async Task <TChannel> GetServiceAsync <TChannel>(ChannelProxy <TChannel> proxy, CancellationToken cancellationToken = default(CancellationToken)) where TChannel : class { return(await Task.Factory.StartNew <TChannel>(p => GetService <TChannel>(proxy, (CancellationToken)p), cancellationToken, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Default)); }