Exemple #1
0
        private void onStorageWndClosed(object sender, EventArgs e)
        {
            var ap = DataContext as ArgPoint;

            if (ap == null)
            {
                return;
            }

            if (_storageWnd == null)
            {
                return;
            }

            if (_storageWnd.filesToAttach != null)
            {
                foreach (StorageSelectionEntry entry in _storageWnd.filesToAttach)
                {
                    try
                    {
                        var attach = AttachmentManager.AttachCloudEntry(ap, entry);
                        var seldId = SessionInfo.Get().person.Id;
                        attach.Person = PrivateCenterCtx.Get().Person.FirstOrDefault(p0 => p0.Id == seldId);

                        ap.ChangesPending = true;

                        var ev = StEvent.ArgPointTopicChanged;
                        switch ((AttachmentFormat)attach.Format)
                        {
                        case AttachmentFormat.Bmp:
                        case AttachmentFormat.Jpg:
                        case AttachmentFormat.Png:
                            ev = StEvent.ImageAdded;
                            break;

                        case AttachmentFormat.Pdf:
                            ev = StEvent.PdfAdded;
                            break;
                        }
                        if (ev != StEvent.ArgPointTopicChanged)
                        {
                            UISharedRTClient.Instance.clienRt.SendStatsEvent(
                                ev,
                                ap.Person.Id,
                                ap.Topic.Discussion.Id,
                                ap.Topic.Id,
                                DeviceType.Wpf);
                        }
                    }
                    catch (Discussions.AttachmentManager.IncorrectAttachmentFormat)
                    {
                    }
                }

                UpdateOrderedMedia();
                BeginAttachmentNumberInjection();
            }

            _storageWnd.fileViewCallback -= onCloudViewerRequest;
            _storageWnd.Closed           -= onStorageWndClosed;
            _storageWnd = null;
        }