private void ShowGif(KnowledgeInfo knowledgeInfo) { string BaseDirectoryPath = AppDomain.CurrentDomain.BaseDirectory; string path = BaseDirectoryPath + "Gif\\" + knowledgeInfo.Id + ".gif"; if (File.Exists(path)) { Application.Current.MainWindow.WindowState = WindowState.Maximized; DemonstrateWindow window = new DemonstrateWindow(path, knowledgeInfo.Knowledge); window.WindowState = WindowState.Maximized; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; (Application.Current.MainWindow as WindowX).IsMaskVisible = true; window.ShowDialog(); (Application.Current.MainWindow as WindowX).IsMaskVisible = false; } else { MessageBoxHelper.MessageBoxShowWarning("文件不存在!"); } }
private void Button_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; string BaseDirectoryPath = AppDomain.CurrentDomain.BaseDirectory; string path = BaseDirectoryPath + "Gif\\" + button.Tag + ".gif"; if (File.Exists(path)) { Application.Current.MainWindow.WindowState = WindowState.Maximized; DemonstrateWindow window = new DemonstrateWindow(path, button.Content.ToString()); window.WindowState = WindowState.Maximized; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; (Application.Current.MainWindow as WindowX).IsMaskVisible = true; window.ShowDialog(); (Application.Current.MainWindow as WindowX).IsMaskVisible = false; } else { MessageBoxHelper.MessageBoxShowWarning("文件不存在!"); } }