コード例 #1
0
ファイル: Events.cs プロジェクト: kicka5h/Lorry
        public void uxDeleteEditedPoem_Click(object sender, RoutedEventArgs e)
        {
            Lorry.Repository.IDatabaseRepository <Repository.Recents.Recent> getRecent = new Lorry.Repository.Recents.RecentRepository();
            Main.Recent deleteRecent = MainViewModel.Recents.Where(t => t.RecentContent == classContent).SingleOrDefault();

            Repository.Recents.Recent finallyDelete = deleteRecent.ToRepositoryModel();
            getRecent.Delete(finallyDelete);

            this.Close();
        }
コード例 #2
0
        public CoupletWindow()
        {
            InitializeComponent();

            DataContext = Recents;
            uxCoupletList.DataContext = MainViewModel.Recents;
            Lorry.Main.Recent recentCouplet = MainViewModel.Recents.Where(t => t.RecentType == "couplet").LastOrDefault();
            uxCoupletRecent.DataContext = recentCouplet.RecentContent;

            uxCoupletList.ItemsSource = MainViewModel.Recents.Where(t => t.RecentType == "couplet");
            uxCoupletRecent.Content   = recentCouplet.RecentContent;
        }
コード例 #3
0
ファイル: Events.cs プロジェクト: kicka5h/Lorry
        public void uxCoupletList_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            MainWindow mainWindow = new MainWindow();

            Lorry.Repository.IDatabaseRepository <Repository.Recents.Recent> getRecent = new Lorry.Repository.Recents.RecentRepository();

            Main.Recent item = (Main.Recent)mainWindow.uxCoupletList.Items.CurrentItem;
            classContent = item.RecentContent;

            EditPoem editPoem = new EditPoem();

            editPoem.Show();
        }
コード例 #4
0
ファイル: Events.cs プロジェクト: kicka5h/Lorry
        public void uxSaveEditedButton_Click(object sender, RoutedEventArgs e)
        {
            EditPoem editPoem = new EditPoem();

            Lorry.Repository.IDatabaseRepository <Repository.Recents.Recent> getRecent = new Lorry.Repository.Recents.RecentRepository();
            Main.Recent newRecent = MainViewModel.Recents.Where(t => t.RecentContent == classContent).SingleOrDefault();

            newRecent.RecentContent = editPoem.uxTextBoxEditPoem.Text;
            newRecent.RecentId      = newRecent.RecentId;

            MainViewModel.SaveRecent(newRecent);

            this.Close();
        }
コード例 #5
0
        public void uxCoupletList_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (MessageBox.Show($"Are you sure you'd like to delete this poem?", "", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) == MessageBoxResult.Yes)
            {
                MainWindow mainWindow = new MainWindow();
                Lorry.Repository.IDatabaseRepository <Repository.Recents.Recent> getRecent = new Lorry.Repository.Recents.RecentRepository();

                Main.Recent item    = (Main.Recent)mainWindow.uxCoupletList.Items.CurrentItem;
                string      content = item.RecentContent;

                Main.Recent deleteRecent = MainViewModel.Recents.Where(t => t.RecentContent == content).SingleOrDefault();
                Repository.Recents.Recent finallyDelete = deleteRecent.ToRepositoryModel();

                getRecent.Delete(finallyDelete);

                MessageBox.Show("Okay, poem has been deleted.");
            }
            else
            {
            };
        }