Ejemplo n.º 1
0
 public Array RefreshData(ref int topicCount)
 {
     Dictionary<string, object> dictionary = new Dictionary<string, object>();
     object[,] array = new object[2, this.Topics.Count];
     try
     {
         if (this.Proxy == null)
         {
             this.CreateProxy();
         }
         dictionary = this.Proxy.GetData(this.TopicsCount.Keys.ToArray<string>());
         int num = 0;
         foreach (KeyValuePair<int, string> current in this.Topics)
         {
             array[0, num] = current.Key;
             array[1, num] = dictionary[current.Value];
             num++;
         }
         this.RefreshTimer.Interval = this.Proxy.GetRefreshInterval();
     }
     catch
     {
         this.Proxy = null;
         int num2 = 0;
         foreach (KeyValuePair<int, string> current2 in this.Topics)
         {
             array[0, num2] = current2.Key;
             array[1, num2] = current2.Value;
             num2++;
         }
         this.RefreshTimer.Interval = 2000;
     }
     topicCount = this.Topics.Count;
     this.RefreshTimer.Start();
     return array;
 }
Ejemplo n.º 2
0
 private void CreateProxy()
 {
     try
     {
         this.Proxy = new ChannelFactory<IRTDObject>(new NetNamedPipeBinding(),
                                                     new EndpointAddress("net.pipe://localhost/Rotman/RIT/RTD")).CreateChannel();
         ((IClientChannel)this.Proxy).Faulted += delegate(object sender, EventArgs e)
         {
             this.Proxy = null;
         };
         ((IClientChannel)this.Proxy).Closed += delegate(object sender, EventArgs e)
         {
             this.Proxy = null;
         };
     }
     catch
     {
     }
 }
Ejemplo n.º 3
0
 public void ServerTerminate()
 {
     if (this.RefreshTimer != null)
     {
         this.RefreshTimer.Dispose();
         this.RefreshTimer = null;
     }
     if (this.Proxy != null)
     {
         try
         {
             ((ICommunicationObject)this.Proxy).Close();
         }
         finally
         {
             this.Proxy = null;
         }
     }
 }