public void AddFileHandle(AddFileMessage addFileMessage) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = "Document"; // Default file name dlg.DefaultExt = ".jpeg"; // Default file extension dlg.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif"; // Filter files by extension //display Nullable <bool> result = dlg.ShowDialog(); if (result == true) { string fn = dlg.FileName; } }
private void User_MessageReceived(Message message) { if (message is Introduction) { SetOperatorName setOperatorName = SetOperatorName; Dispatcher.Invoke(setOperatorName, (message as Introduction).Name); Dispatcher.Invoke(Init); } if (message is TextMessage) { AddTextMessage addTextMessageDele = AddTextMessage; Dispatcher.Invoke(addTextMessageDele, message as TextMessage, operatorName); } else if (message is FileMessage) { AddFileMessage addFileMessageDele = AddFileMessage; Dispatcher.Invoke(addFileMessageDele, message as FileMessage, operatorName); } }