private async void Admin_OnJobConfigurationReceived(Job_Configuration configuration)
        {
            PersistenceManager.SaveJobConfiguration(configuration);

            await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (this.currentShow != null)
                {
                    this.currentShow.Cancel();
                    this.currentShow = null;

                    this.LayoutContainer.Children.Clear();                    
                }

                this.currentShow = new Show(configuration, new Size(rootGrid.ActualWidth, rootGrid.ActualHeight));

                this.LayoutContainer.Children.Add(this.currentShow.ContentWindow.GetRoot());

                this.currentShow.Start();
            });
        }
        private async void Admin_OnCancelRequestReceived(Guid jobID, CancelJobReason reason)
        {
            await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (this.currentShow != null)
                {
                    this.currentShow.Cancel();
                    this.currentShow = null;

                    this.LayoutContainer.Children.Clear();

                    EventsManager.Log(Job_EventType.Aborted, null, "Job " + jobID.ToString() + " has been canceled. Reason: " + reason.ToString());
                }
            });
        }
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            // check image
            BitmapImage img = await PersistenceManager.GetConfigurationImage();

            if (img == null)
            {
                string noconfPath = Path.Combine(await PersistenceManager.GetAssetsPath(), "NoConf.PNG");

                img = new BitmapImage(new Uri(noconfPath));

                PersistenceManager.SaveConfigurationImage(PersistenceManager.GetFile(noconfPath));
            }

            this.rootGrid.Background = new ImageBrush() { ImageSource = img };

            // start listener
            this.adminListener = new Server(NetworkConfiguration.PortPi);
            this.adminListener.OnConnectionReceived += AdminListener_OnConnectionReceived;

            this.adminListener.Start();

            // check saved configuration
            Job_Configuration configuration = null; // PersistenceManager.GetJobConfiguration();

            if (configuration != null)
            {
                if (this.currentShow != null)
                {
                    this.currentShow.Cancel();
                    this.currentShow = null;

                    this.LayoutContainer.Children.Clear();
                }

                this.currentShow = new Show(configuration, new Size(rootGrid.ActualWidth, rootGrid.ActualHeight));

                this.LayoutContainer.Children.Add(this.currentShow.ContentWindow.GetRoot());

                this.currentShow.Start();
            }
        }