示例#1
0
 protected override void DisposeMenu()
 {
     base.DisposeMenu();
     DataContext = null;
     viewModel.Dispose();
     viewModel = null;
 }
        public MainWindow()
        {
            InitializeComponent();
            var viewModel = new ViewModelMainWindow();

            DataContext            = viewModel;
            viewModel.CloseWindow += (sender, e) => { Close(); };
        }
示例#3
0
 protected override void OnUnloaded()
 {
     base.OnUnloaded();
     DataContext = null;
     ViewModel   = null;
     if (Instance == this)
     {
         Instance = null;
     }
 }
示例#4
0
        public MainWindow()
        {
            InitializeComponent();
            DataContext              = new ViewModelMainWindow();
            FrameMainWindow.Content  = new PageRealTimeData();
            RbRealTimeData.IsChecked = true;
            SettingXML xML = new SettingXML();

            xML.XmlCreate();
        }
示例#5
0
        /// <summary>
        /// Constructeur
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            this.Entities  = new MegacastingEntities();
            this.ViewModel = new ViewModelMainWindow(this.Entities);

#if DEBUG
            _GridAuthentication.Visibility = Visibility.Collapsed;
            ViewModel.CurrentEmployee      = this.Entities.Employes.FirstOrDefault();
#endif
        }
        public NewBookWindow()
        {
            InitializeComponent();

            // Tried to apply the add button, a function to add a book to the Collection.
            // I have done basically the same thing, I have done with the opening Message,
            // but now it calls the function AddBook instead of OpenDialog.
            // But my approach needs some fixing. It adds multiples books on the second time
            // you click the add button. I think its because it registers the Message multiple times.
            // The function needs to be unregistered or the method register needs to be initiated on
            // another place in the project, instead of the Constructor of the Window.

            Messenger.Instance.Register <AddNewBookWindowMessage>(this, () =>
            {
                ViewModelMainWindow viewModel = this.DataContext as ViewModelMainWindow;

                viewModel.AddBook(this.Titel.Text, this.Genre.Text, this.Verlag.Text, this.Autor.Text);

                this.Close();
            });
        }
示例#7
0
 protected override void InitMenu()
 {
     DataContext = viewModel = new ViewModelMainWindow();
 }
示例#8
0
 public MainWindow()
 {
     ViewModelMainWindow = new ViewModelMainWindow(this);
     InitializeComponent();
     CbKat.SelectedIndex = 0;
 }
示例#9
0
 protected override void OnLoaded()
 {
     base.OnLoaded();
     Window.IsCached = true;
     DataContext     = ViewModel = new ViewModelMainWindow();
 }
 internal static void SetRootObject(UserControl target, ViewModelMainWindow value)
 {
     target.SetValue(RootObjectProperty, value);
 }