public MainWindow() { InitializeComponent(); string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string mojeDanePath = Path.Combine(desktopPath, "MojeDane"); HistoryWindowViewModel = new HistoryWindowViewModel(mojeDanePath); this.DataContext = HistoryWindowViewModel; ButtonsViewModel = SerializableButtonItemViewModel.Load(); mainGrid.DataContext = ButtonsViewModel; ButtonFacade.CloseApplication = () => { ButtonsViewModel.WholeClickCount++; SerializableButtonItemViewModel.Save(ButtonsViewModel); Close(); }; MyDataItem.CloseApplication = () => { ButtonsViewModel.WholeClickCount++; SerializableButtonItemViewModel.Save(ButtonsViewModel); Close(); }; MyDataNotes.CloseApplication = () => { ButtonsViewModel.WholeClickCount++; SerializableButtonItemViewModel.Save(ButtonsViewModel); Close(); }; }
private void OnShowHistory(object obj) { if (historyWindow == null) { historyWindow = new HistoryWindow(); historyWindowViewModel = new HistoryWindowViewModel(); historyWindow.DataContext = historyWindowViewModel; } historyWindow.Show(); }
public HistoryWindow(string historyText) { InitializeComponent(); DataContext = new HistoryWindowViewModel(historyText); }