示例#1
0
        private void btnOpen_Click(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Open task file";
            openFileDialog.Filter = "Task Time Tracker file|*.ttt";

            if (openFileDialog.ShowDialog() == true)
            {
                try
                {
                    var tt = TaskTimeViewModel.FromFile(openFileDialog.FileName);
                    _vm.ActiveTaskTime = tt;
                    _vm.ActiveTaskTime.TriggerNotifyAll();
                }
                catch
                { }
            }
        }
示例#2
0
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            var saveFileDialog = new SaveFileDialog();

            saveFileDialog.Title  = "Choose task file to create";
            saveFileDialog.Filter = "Task Time Tracker file|*.ttt";

            if (saveFileDialog.ShowDialog() == true)
            {
                try
                {
                    var tt = TaskTimeViewModel.CreateNewFile(saveFileDialog.FileName);
                    _vm.ActiveTaskTime = tt;
                    _vm.ActiveTaskTime.TriggerNotifyAll();
                }
                catch
                { }
            }
        }