示例#1
0
        //Этот метод вызывается нашими собеседниками когда они хотят отобразить свое сообщение на наш экран

        public void DisplayMessage(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            _displayMessageDelegate?.Invoke(composite);
        }
示例#2
0
        internal void Open(object obj)
        {
            if (obj == null)
            {
                return;
            }
            var items         = (obj as ObservableCollection <object>).Cast <DownloaderObjectModel>().ToList();
            var itemsFinished = from item in items
                                where item.Status == DownloadStatus.Finished
                                where new FileInfo(item.Destination).Exists
                                select item;

            if (itemsFinished.Count() > 1)
            {
                var r = _displayMessage.Invoke(
                    "You have selected to open " + itemsFinished.Count() + " files.\n\n" +
                    "Opening too many files at the same file may cause the system to crash.\n\nDo you wish to proceed?",
                    "Open", MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.No);

                if (r == MessageBoxResult.No)
                {
                    return;
                }
            }
            foreach (var item in itemsFinished)
            {
                Process.Start("explorer.exe", "\"" + item.Destination + "\"");
            }
        }
示例#3
0
 public void TransferFile(string filename, byte[] fileData)
 {
     _displayFileDelegate?.Invoke(new CompositeType(filename, fileData));
 }