Exemple #1
0
        public MainPage()
        {
            this.InitializeComponent();

            ApplicationView.PreferredLaunchViewSize = new Size(500, 800);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            this.NavigationCacheMode = NavigationCacheMode.Required;

            navigationHelper = new NavigationHelper(this);
            navigationHelper.LoadState += NavigationHelper_LoadState;
            navigationHelper.SaveState += NavigationHelper_SaveState;

            if (!DesignMode.DesignModeEnabled)
            {
                DataContext = ViewModel = CompositionManager.Current.GetInstance<ICompositionFactory>().Create<MainViewModel>();
                ViewModel.View = this;

                var eventAggregator = CompositionManager.Current.GetInstance<IEventAggregator>();

                eventAggregator.GetEvent<EntryCreatedEvent>().Subscribe(OnEntryCreated);
                eventAggregator.GetEvent<EntryEditingFinishedEvent>().Subscribe(OnEntryEditingFinished);

                Loaded += OnLoaded;
            }
        }
Exemple #2
0
        public NewEntryPage()
        {
            this.InitializeComponent();

            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
        }
        public EntryDetailsPage()
        {
            InitializeComponent();

            if (!DesignMode.DesignModeEnabled)
            {
                DataContext = CompositionManager.Current.GetInstance<ICompositionFactory>().Create<EntryDetailsViewModel>();
                ViewModel.View = this;
            }

            navigationHelper = new NavigationHelper(this);
            navigationHelper.LoadState += NavigationHelper_LoadState;
            navigationHelper.SaveState += NavigationHelper_SaveState;
        }