private void ItemFileTransfer_ValueLoaded(object sender, EventArgs e) { this.@event = this.Value; if (this.@event == null) { LOG.Error("Event is null"); return; } if ([email protected] == null) { LOG.Error("No MSRP session associated to this event"); return; } [email protected] += this.MsrpSession_onMsrpEvent; switch ([email protected]) { case HistoryEvent.StatusType.Incoming: this.labelDescription.Content = String.Format("Receiving from {0}...", UriUtils.GetDisplayName([email protected])); this.buttonAccept.Content = "accept"; this.buttonDecline.Content = "decline"; this.gradientStop.Color = Colors.Bisque; break; case HistoryEvent.StatusType.Outgoing: this.labelDescription.Content = "Sending..."; this.buttonAccept.Visibility = Visibility.Collapsed; this.buttonDecline.Content = "abort"; this.gradientStop.Color = Colors.SkyBlue; break; case HistoryEvent.StatusType.Failed: default: this.gradientStop.Color = Colors.Red; break; } this.labelDate.Content = BaseItem <HistoryFileTransferEvent> .GetFriendlyDateString([email protected]); this.fileName = new FileInfo([email protected]).Name; this.textBlockName.Text = this.fileName; if (File.Exists([email protected])) { using (System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon([email protected])) { this.imageIcon.Source = MyImageConverter.FromIcon(icon); } } }
private void ItemHistoryFileTransferEvent_ValueLoaded(object sender, EventArgs e) { this.@event = this.Value; this.fileInfo = String.IsNullOrEmpty([email protected]) ? null : new System.IO.FileInfo([email protected]); this.labelInfo.Content = String.Format("{0} - {1}", [email protected], fileInfo != null ? fileInfo.Name : "-"); this.labelDate.Content = BaseItem <HistoryFileTransferEvent> .GetFriendlyDateString([email protected]); this.ctxMenu_AddToContacts.IsEnabled = ([email protected] == null); switch ([email protected]) { case HistoryEvent.StatusType.Failed: default: { this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.document_forbidden_16); break; } case HistoryEvent.StatusType.Incoming: { this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.document_down_16); break; } case HistoryEvent.StatusType.Outgoing: { this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.document_up_16); break; } } if (this.fileInfo == null || !this.fileInfo.Exists) { this.imageIcon.Source = MyImageConverter.FromBitmap(Properties.Resources.document_forbidden_32); this.ctxMenu_OpenFile.IsEnabled = false; } else { using (System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon(this.fileInfo.FullName)) { this.imageIcon.Source = MyImageConverter.FromIcon(icon); } this.ctxMenu_OpenFile.IsEnabled = true; } this.Width = Double.NaN; }
private void sipService_onInviteEvent(object sender, InviteEventArgs e) { if (this.@event == null || [email protected] == null) { return; } if (e.SessionId != [email protected]) { return; } if (this.Dispatcher.Thread != System.Threading.Thread.CurrentThread) { this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new EventHandler <InviteEventArgs>(this.sipService_onInviteEvent), sender, new object[] { e }); return; } switch (e.Type) { case InviteEventTypes.CONNECTED: { if (this.imageIcon.Source == null && File.Exists([email protected])) { using (System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon([email protected])) { this.imageIcon.Source = MyImageConverter.FromIcon(icon); } } this.buttonAccept.Visibility = Visibility.Collapsed; this.buttonDecline.Visibility = Visibility.Visible; this.buttonDecline.Content = "abort"; break; } case InviteEventTypes.DISCONNECTED: { if (!this.done) { this.buttonAccept.Visibility = Visibility.Collapsed; this.buttonDecline.Visibility = Visibility.Collapsed; this.progressBar.Visibility = Visibility.Collapsed; this.labelDescription.Content = String.Format("File transfer Failed ({0})", e.Phrase); this.gradientStop.Color = Colors.Red; this.imageIcon.Cursor = Cursors.No; } else { this.imageIcon.Cursor = Cursors.Hand; this.imageIcon.Tag = [email protected]; } this.sipService.onInviteEvent -= this.sipService_onInviteEvent; break; } default: break; } }