Esempio n. 1
0
        public MainWindowPage()
        {
            InitializeComponent();

            _timer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(500)
            };
            _timer.Tick += TimerOnTick;

            BackgroundWorker workerTimer = new BackgroundWorker();

            workerTimer.WorkerSupportsCancellation = true;
            workerTimer.DoWork += workerTimer_DoWork;
            workerTimer.RunWorkerAsync();

            Messenger.Default.Register <OpenWindowMessage>(
                this,
                message => {
                if (message.Type == WindowType.AddAppWindow)
                {
                    var addAppWindow = new AddAppWindow();
                    addAppWindow.ShowDialog();
                }
                if (message.Type == WindowType.AddAboutAppointmentWindow && message.Argument == "Load this appointment")
                {
                    var addAboutWindow = new AboutAppWindow();
                    // send initialize information after create, but before show window!
                    // send this message => initialize new check at this cycle
                    Messenger.Default.Send(new OpenWindowMessage {
                        Type = WindowType.None, Argument = message.Argument, Appointment = message.Appointment
                    });
                    addAboutWindow.ShowDialog();
                }
                if (message.Type == WindowType.AddAllAppByLocationWindow)
                {
                    var addAllAppWindow = new AllAppByLocation();
                    // send initialize information after create, but before show window!
                    Messenger.Default.Send(new OpenWindowMessage {
                        Type = WindowType.LoadLocations, Argument = message.Argument
                    });
                    addAllAppWindow.ShowDialog();
                }
                if (message.Type == WindowType.Sync && message.User != null)
                {
                    var addSync = new SyncWindow();
                    Messenger.Default.Send(new OpenWindowMessage {
                        Type = WindowType.None, User = message.User, Argument = message.Argument
                    });
                    addSync.ShowDialog();
                }
                if (message.Type == WindowType.CalendarFrame)
                {
                    var calendarFrameWindow = new CalendarFrame();
                    calendarFrameWindow.ShowDialog();
                }
            });
            Messenger.Default.Register <NotificationMessage>(this, message =>
            {
                if (message.Notification.Equals("CreateGroup"))
                {
                    var addGroupWindow = new AddGroupWindow();
                    addGroupWindow.ShowDialog();
                }
            });
        }
        public void DisplayAboutAppWindow()
        {
            var dlg = new AboutAppWindow();

            ShowModalDialog(dlg);
        }