Exemple #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _fileIOService = new FileIOService(PATH);
            if (!Directory.Exists(PATHPICK))
            {
                Directory.CreateDirectory(PATHPICK);
            }

            try
            {
                _tjData = _fileIOService.LoadData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Close();
            }

            dgTraderTable.ItemsSource = _tjData;
            _tjData.ListChanged      += _tjData_ListChanged;

            Uri startImgPath = new Uri($"{Environment.CurrentDirectory}\\PicData\\Default.png");
        }
        public MainViewModel(MainWindow mainWindow)
        {
            _fileIOService = new FileIOService(PATH);

            Tasks = new ObservableCollection <Task>();

            try
            {
                Tasks = _fileIOService.LoadData();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            AddWindowCommand    = new Command(createAddWindow, canExecuteMethod);
            AddNewTask          = new Command(saveNewTask, canExecuteMethod);
            DeleteSelectedTasks = new Command(deleteSelectedTasks, canExecuteMethod);
            SortTaskCommand     = new Command(createSortWindow, canExecuteMethod);

            mainWindow.tasksGrid.ItemsSource = Tasks;
            _mainWindow = mainWindow;
        }
Exemple #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _fileIOService = new FileIOService(PATH);

            try
            {
                _todoDataList = _fileIOService.LoadData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Close();
            }

            /*    new BindingList<TodoModel>()
             * {
             *  new TodoModel(){Text = "test"},
             *  new TodoModel(){Text = "I'm bird!"},
             *  new TodoModel(){Text = "I'm bird!", IsDone = true }
             * };*/

            dgTodoList.ItemsSource     = _todoDataList;
            _todoDataList.ListChanged += _todoDataList_ListChanged;
        }
 public AlarmListWindowViewModel()
 {
     Alarms              = FileIOService.LoadData();
     Alarms.ListChanged += AlarmsList_ListChanged;
 }