public Aceuill(SVC.ServiceCliniqueClient proxyrecu, SVC.Membership memberrecu, ICallback callbackrecu, DXWindowMain windowrecu, SVC.Client localclientrecu) { try { InitializeComponent(); proxy = proxyrecu; memberuser = memberrecu; callback = callbackrecu; windowmain = windowrecu; localclient = localclientrecu; if (localclientrecu.Chat) { tile6.Visibility = Visibility.Visible; tile6.IsEnabled = true; } else { tile6.Visibility = Visibility.Collapsed; tile6.IsEnabled = false; } } catch (Exception ex) { } }
public Chat(SVC.Client LOCALCLIENTRECU, ICallback callbackrecu, SVC.ServiceCliniqueClient proxy1, DXWindowMain main, Membership memberrecu) { try { InitializeComponent(); // proxy.ReConnectAsync(LOCALCLIENTRECU); callbackrecu.callback += new ICallback.CallbackEventHandler(callbackrecu_callback); callbackrecu.callbackUserjoin += new ICallback.CallbackEventHandler1(callbackrecu_callbackjoin); callbackrecu.callbackUserLeave += new ICallback.CallbackEventHandler2(callbackrecu_callbackleave); callbackrecu.callbackMessageRecu += new ICallback.CallbackEventHandler3(callbackrecu_callbackReceive); callbackrecu.IsWritingCallbackEvent += new ICallback.CallbackEventHandler4(callbackrecu_callbackIswrite); callbackrecu.InsertReceiveFileCallbackevent += new ICallback.CallbackEventHandler47(callbackrecureceiveFile_callbackIswrite); callbackrecu.InsertReceiveWhisperCallbackevent += new ICallback.CallbackEventHandler48(callbackrecureceiveWhisper_callbackWhisperReceive); Membershipsession = memberrecu; chatListBoxNames.SelectionChanged += new SelectionChangedEventHandler(chatListBoxNames_SelectionChanged); chatTxtBoxType.KeyDown += new KeyEventHandler(chatTxtBoxType_KeyDown); chatTxtBoxType.KeyUp += new KeyEventHandler(chatTxtBoxType_KeyUp); proxy = proxy1; localClient = LOCALCLIENTRECU; chatLabelCurrentUName.Content = localClient.UserName; main.AddEvent += new EventHandler(addClientWindow_AddEvent); proxy.ReConnectAsync(LOCALCLIENTRECU); proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted); proxy.InnerDuplexChannel.Closed += new EventHandler(InnerDuplexChannel_Closed); DirectoryInfo dir = new DirectoryInfo(rcvFilesPath); dir.Create(); /* var ist = proxy.GetAllClientDict(); * * foreach(var Item in ist.ToList()) * { * MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("List Dictionnary " +Item.Key.UserName.ToString()+" "+Item.Value.ToString(), Medicus.Properties.Resources.SiteWeb, MessageBoxButton.YesNo, MessageBoxImage.Question); * * } * * List<Client> ist1 = proxy.GetAllClient(); * * foreach(var Item in ist1.ToList()) * { * MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("LIST CLIENT "+Item.UserName.ToString()+" ", Medicus.Properties.Resources.SiteWeb, MessageBoxButton.YesNo, MessageBoxImage.Question); * * } */ } catch (Exception ex) { HandleProxy(); } }
private void HandleProxy() { try { if (proxy != null) { switch (this.proxy.State) { case CommunicationState.Closed: proxy = null; break; case CommunicationState.Closing: break; case CommunicationState.Created: break; case CommunicationState.Faulted: proxy.Abort(); proxy = null; Confirmer.IsEnabled = false; textBlockss.Content = "User Hors ligne "; textBlockss.Visibility = Visibility.Visible; break; case CommunicationState.Opened: if (connectionok == true) { DXWindowMain cl = new DXWindowMain(proxy, Membership, callback, localClient); cl.Show(); using (StreamWriter writer = new StreamWriter(System.Environment.CurrentDirectory + "/IPTEXTE.txt", false)) { writer.WriteLine(loginTxtBoxIP.Text); } downloadlogo(proxy); this.Close(); } else { proxy.Abort(); proxy = null; } break; case CommunicationState.Opening: break; default: break; } } } catch (Exception ex) { MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop); } }