public AddServerPage()
        {
            InitializeComponent();

            MDEDB = new MDEDataContext();

            this.DataContext = this;
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            MDEDB = new MDEDataContext();

            int meetingID = int.Parse(NavigationContext.QueryString["meetingID"]);
            meeting = new ObservableCollection<Meeting>(from Meeting m in MDEDB.Meetings where m.ID == meetingID select m)[0];

            base.OnNavigatedTo(e);
        }
        public JoinMeetingPage()
        {
            InitializeComponent();

            MDEDB = new MDEDataContext();
            server = new Server();
            _timer = new DispatcherTimer();
            _timer.Interval = TimeSpan.FromMilliseconds(100);
            _timer.Tick += (o, arg) => ScanPreviewBuffer();
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            MDEDB = new MDEDataContext();

            // Define the query to gather all of the to-do items.
            var serversInDB = from Server s in MDEDB.Servers
                                select s;

            // Execute the query and place the results into a collection.
            servers = new ObservableCollection<Server>(serversInDB);

            // Call the base method.
            base.OnNavigatedTo(e);
        }
        //private List<File> files;
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            MDEDB = new MDEDataContext();
            int meetingID = int.Parse(NavigationContext.QueryString["meetingID"]);

            meeting = new ObservableCollection<Meeting>(from Meeting m in MDEDB.Meetings where m.ID == meetingID select m)[0];
            //server = meeting.server;
            //files = meeting.files.ToList();

            serverNameBlock.Text = meeting.server.serverName;
            meetingNameBlock.Text = meeting.title;

            imgQRCode.Source = GenerateQRCode("mde;"+meeting.server.address+";"+meeting.serverMeetingID+";"+meeting.code);
            base.OnNavigatedTo(e);
        }
        //Code for initialization, capture completed, image availability events; also setting the source for the viewfinder.
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            MDEDB = new MDEDataContext();
            int meetingID = int.Parse(NavigationContext.QueryString["meetingID"]);

            meeting = new ObservableCollection<Meeting>(from Meeting m in MDEDB.Meetings where m.ID == meetingID select m)[0];

            // Check to see if the camera is available on the phone.
            if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
                 (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
            {
                // Initialize the camera, when available.
                if (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing))
                {
                    // Use front-facing camera if available.
                    cam = new Microsoft.Devices.PhotoCamera(CameraType.FrontFacing);
                }
                else
                {
                    // Otherwise, use standard camera on back of phone.
                    cam = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
                }

                // Event is fired when the PhotoCamera object has been initialized.
                cam.Initialized += new EventHandler<Microsoft.Devices.CameraOperationCompletedEventArgs>(cam_Initialized);

                // Event is fired when the capture sequence is complete and an image is available.
                cam.CaptureImageAvailable += new EventHandler<Microsoft.Devices.ContentReadyEventArgs>(cam_CaptureImageAvailable);

                //Set the VideoBrush source to the camera.
                viewfinderBrush.SetSource(cam);
            }
            else
            {
                // The camera is not supported on the phone.
                this.Dispatcher.BeginInvoke(delegate()
                {
                    // Write message.
                    txtDebug.Text = "A Camera is not available on this phone.";
                    // Disable UI.
                    ShutterButton.IsEnabled = false;
                });

            }
        }
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            // Create the database if it does not exist.
            using (MDEDataContext db = new MDEDataContext())
            {
                if (db.DatabaseExists() == false)
                {
                    //Create the database
                    db.CreateDatabase();
                }
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            MDEDB = new MDEDataContext();
            string serverName = NavigationContext.QueryString["serverName"];

            server = new ObservableCollection<Server>(from Server s in MDEDB.Servers where s.serverName == serverName select s)[0];

            serverNameTextBox.Text = serverName;

            meetings = new ObservableCollection<Meeting>(server.meetings);
            refresh();
            _timer.Start();

            base.OnNavigatedTo(e);
        }
        public ServerOptionsPage()
        {
            InitializeComponent();

            MDEDB = new MDEDataContext();
        }
        public NewMeetingPage()
        {
            InitializeComponent();

            MDEDB = new MDEDataContext();
        }
        public EditMeetingSettingsPage()
        {
            InitializeComponent();

            MDEDB = new MDEDataContext();
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            #region Actualising navigation stack
            bool remove = false;

            if (NavigationContext.QueryString.ContainsKey("removePrevious"))
            {
                remove = ((string)NavigationContext.QueryString["removePrevious"]).Equals(bool.TrueString);
                NavigationContext.QueryString.Remove("removePrevious");
            }

            if (remove)
            {
                NavigationService.RemoveBackEntry();
            }
            #endregion

            MDEDB = new MDEDataContext();
            int meetingID = int.Parse( NavigationContext.QueryString["meetingID"] );

            meeting = new ObservableCollection<Meeting>(from Meeting m in MDEDB.Meetings where m.ID == meetingID select m)[0];
            server = meeting.server;
            files = new ObservableCollection<File>(meeting.files);

            PivotRoot.Title = server.serverName;

            #region Details
            titleBlock.Text = meeting.title;
            topicBlock.Text = meeting.topic;
            organisatorBlock.Text = meeting.adminName;
            if (meeting.endTime == null)
            {
                timeBlock.Text = meeting.startTime;
                stateBlock.Text = "Trwa (liczba użytkowników: " + meeting.numerOfMembers + " )";
            }
            else
            {
                timeBlock.Text = meeting.startTime + " - " + meeting.endTime;
                stateBlock.Text = "Zakończone (l. użytkowników: " + meeting.numerOfMembers + " )";
            }
            //permision = 0 - member
            //1 - member upload
            //2 - admin
            if (meeting.permissions == 2)
            {
                permissionBlock.Text = "Admin";
                settingsButton.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                settingsButton.Visibility = System.Windows.Visibility.Collapsed;
                if(meeting.permissions == 1)
                    permissionBlock.Text = "Member with upload permission";
                else
                    permissionBlock.Text = "Member without upload permission";
            }
            #endregion

            refresh();
            _timer.Start();

            base.OnNavigatedTo(e);
        }
        public EditPersonalDataPage()
        {
            InitializeComponent();

            MDEDB = new MDEDataContext();
        }