Beispiel #1
0
		public void Connect(IProvider provider)
		{
			if (provider.IsConnected)
				return;
			if (this.useMessageLoop)
			{
				this.form.BeginInvoke((Action)(() => provider.Connect()));
				if ((int)provider.Id == 1 || (int)provider.Id == 2)
				{
					ProviderManager.WaitConnected(provider, (int)this.ConnectionTimeout.TotalMilliseconds);
				}
				else
				{
					ProviderHelperForm f = new ProviderHelperForm();
					f.Init(provider, (int)this.ConnectionTimeout.TotalSeconds);
					MethodInvoker methodInvoker = (MethodInvoker)(() =>
					{
						int temp_75 = (int)f.ShowDialog((IWin32Window)this.parentForm);
						f.Dispose();
					});
					if (this.parentForm.InvokeRequired)
						this.parentForm.Invoke((Delegate)methodInvoker);
					else
						methodInvoker();
				}
			}
			else
				provider.Connect((int)this.ConnectionTimeout.TotalMilliseconds);
		}
Beispiel #2
0
 public void Connect(IProvider provider)
 {
     if (provider.IsConnected)
     {
         return;
     }
     if (this.useMessageLoop)
     {
         this.form.BeginInvoke((Action)(() => provider.Connect()));
         if ((int)provider.Id == 1 || (int)provider.Id == 2)
         {
             ProviderManager.WaitConnected(provider, (int)this.ConnectionTimeout.TotalMilliseconds);
         }
         else
         {
             ProviderHelperForm f = new ProviderHelperForm();
             f.Init(provider, (int)this.ConnectionTimeout.TotalSeconds);
             MethodInvoker methodInvoker = (MethodInvoker)(() =>
             {
                 int temp_75 = (int)f.ShowDialog((IWin32Window)this.parentForm);
                 f.Dispose();
             });
             if (this.parentForm.InvokeRequired)
             {
                 this.parentForm.Invoke((Delegate)methodInvoker);
             }
             else
             {
                 methodInvoker();
             }
         }
     }
     else
     {
         provider.Connect((int)this.ConnectionTimeout.TotalMilliseconds);
     }
 }