예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button.Tag.ToString() == "confirm")
            {
                bool rs = CheckProject();
                if (!rs)
                {
                    return;
                }
                (App.Current.Resources["Locator"] as ViewModelLocator).Main.Projects.Add(project);
                SQliteDbContext.AddProject(project);
                string msg = IsModify ? "修改成功!" : "添加成功!";
                MessageBox.Show(msg, "Info", MessageBoxButton.OK, MessageBoxImage.Information);
                this.Close();
            }
            else if (button.Tag.ToString() == "cancel")
            {
                if (!IsModify)
                {
                    foreach (var item in grid.Children)
                    {
                        if (item is TextBox)
                        {
                            (item as TextBox).Text = "";
                        }
                    }
                }
                //project.Author = (App.Current.Resources["Locator"] as ViewModelLocator).Main.User.EmployeeNumbe;
            }
        }