public AboutViewModel() : base("About", new Uri(typeof(AboutView).FullName, UriKind.Relative)) { AssemblyInfo = Assembly.GetEntryAssembly().GetName(); getLibraryVersionsInfo(); LogCommand = new Command(() => { LogCommand.IsExecutable = false; LogView logView = new LogView(); logView.Closed += logView_Closed; logView.Show(); }); }
public MainWindowViewModel() { WindowTitle = "MediaViewer"; // recieve messages requesting the display of media items /* GlobalMessenger.Instance.Register<string>("MainWindowViewModel.ViewMediaCommand", new Action<string>((fileName) => { ViewMediaCommand.DoExecute(fileName); })); */ ViewMediaCommand = new Command<String>(new Action<String>((location) => { if (String.IsNullOrEmpty(location)) return; String mimeType = MediaFormatConvert.fileNameToMimeType(location); if (mimeType.StartsWith("image")) { CurrentImageLocation = location; } else if (mimeType.StartsWith("video")) { CurrentVideoLocation = location; } else { Logger.Log.Warn("Trying to view media of unknown mime type: " + (string)location + ", mime type: " + mimeType); } })); TagEditorCommand = new Command(() => { //TagEditorView tagEditor = new TagEditorView(); //tagEditor.ShowDialog(); }); ShowLogCommand = new Command(() => { //log4net.Appender.IAppender[] appenders = log4net.LogManager.GetRepository().GetAppenders(); //VisualAppender appender = (VisualAppender)(appenders[0]); LogView logView = new LogView(); //logView.DataContext = appender.LogViewModel; logView.Show(); }); ClearHistoryCommand = new Command(() => { if (MessageBox.Show("Clear all history?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { Settings.Default.Reset(); } }); }