Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Windows.Threading;
- namespace Agam_Cinema
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- public class Movie
- {
- public string Name { get; set; }
- public string Genre { get; set; }
- public bool Dubbed { get; set; }
- public bool Is3d { get; set; }
- }
- public List<Movie> lstMovies = new List<Movie>();
- public class Item
- {
- public string Name { get; set; }
- public string Genre { get; set; }
- public bool Dubbed { get; set; }
- public bool TD { get; set; }
- }
- public class DataItem
- {
- public string name { get; set; }
- public string genre { get; set; }
- public bool dubbed { get; set; }
- public bool is3d { get; set; }
- }
- public void CallbackAddMovie(string mname, string mgenre, bool mdubbed, bool mis3d)
- {
- this.dataGrid1.Items.Add(new DataItem { name = "Movie name2", genre = "Action", dubbed = true, is3d = true });
- this.dataGrid1.Items.Add(new DataItem { name = mname, genre = mgenre, dubbed = mdubbed, is3d = mis3d });
- this.dataGrid1.Items.Refresh();
- }
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- lblClock.Content = DateTime.Now.ToString(" hh:mm:ss ");
- //Create timer and update by calliong dispatcher timer tick
- DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
- dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
- dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
- dispatcherTimer.Start();
- var colname = new DataGridTextColumn();
- colname.Header = "Name";
- colname.Binding = new Binding("name");
- dataGrid1.Columns.Add(colname);
- var colgenre = new DataGridTextColumn();
- colgenre.Header = "Genre";
- colgenre.Binding = new Binding("genre");
- dataGrid1.Columns.Add(colgenre);
- var coldubbed = new DataGridCheckBoxColumn();
- coldubbed.Header = "Dubbed";
- coldubbed.Binding = new Binding("dubbed");
- dataGrid1.Columns.Add(coldubbed);
- var col3d = new DataGridCheckBoxColumn();
- col3d.Header = "3D";
- col3d.IsReadOnly = true;
- col3d.Binding = new Binding("is3d");
- dataGrid1.Columns.Add(col3d);
- dataGrid1.Items.Add(new DataItem { name = "Movie name", genre = "Action", dubbed = true, is3d = true });
- /*lstMovies.Add(new Movie { Name = "Movie name", Genre = "Action", Dubbed = true, Is3d = true });
- dataGrid1.ItemBindingGroup = lstMovies;*/
- }
- private void dispatcherTimer_Tick(object sender, EventArgs e)
- {
- // Updating the Label which displays the current second
- lblClock.Content = DateTime.Now.ToString(" hh:mm:ss ");
- // Forcing the CommandManager to raise the RequerySuggested event
- CommandManager.InvalidateRequerySuggested();
- }
- /// <summary>
- /// Go to movies tab
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, RoutedEventArgs e)
- {
- tabControl1.SelectedIndex = 1;
- lblInfo.Content = " - Movies";
- }
- private void buttonmain_Click(object sender, RoutedEventArgs e)
- {
- tabControl1.SelectedIndex = 0;
- lblInfo.Content = " - Main";
- }
- /// <summary>
- /// Go to move halls
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, RoutedEventArgs e)
- {
- tabControl1.SelectedIndex = 2;
- lblInfo.Content = " - Movie halls";
- }
- /// <summary>
- /// Go to Movie times
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, RoutedEventArgs e)
- {
- tabControl1.SelectedIndex = 3;
- lblInfo.Content = " - Movie times";
- }
- private void button4_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
- private void buttonAdd_Click(object sender, RoutedEventArgs e)
- {
- var newMovie = new AddMovie();
- newMovie.Show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement