// Konstruktor
        public MainPage()
        {
            try
            {
                (App.Current.Resources["PhoneForegroundBrush"] as SolidColorBrush).Color = Colors.White;
                (App.Current.Resources["PhoneDisabledBrush"] as SolidColorBrush).Color = Colors.White;
                (App.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush).Color = Colors.Black;

                InitializeComponent();

                BuildApplicationBar();

                (App.Current as the_flashlight.App).main_page = this;

                AnimationContext = LayoutRoot;

                string deviceNameStr = "unknown device";
                object deviceName;
                if(DeviceExtendedProperties.TryGetValue("DeviceName", out deviceName))
                {
                    deviceNameStr = deviceName.ToString();
                }

                if (deviceNameStr.Contains("Mozart"))
                {
                    this.error_txt.Text = AppResources.err_xenon;
                }
                else if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary) && Microsoft.Devices.Environment.DeviceType != DeviceType.Emulator)
                {
                    _videoCamera = new VideoCamera();

                    // Event is fired when the video camera object has been initialized.
                    _videoCamera.Initialized += VideoCamera_Initialized;
                    _videoCamera.RecordingStarted += VideoCamera_RecordingStarted;

                    // Add the photo camera to the video source
                    _videoCameraVisualizer = new VideoCameraVisualizer();
                    _videoCameraVisualizer.SetSource(_videoCamera);
                }
                else
                {
                    this.error_txt.Text = AppResources.err_no_flash;
                }

                var preload = new InfoPage();
            }
            catch
            {
                Application_Error();
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            try
            {
                // Use standard camera on back of device.
                _videoCamera = new VideoCamera();

                // Event is fired when the video camera object has been initialized.
                _videoCamera.Initialized += VideoCamera_Initialized;

                // Add the photo camera to the video source
                _videoCameraVisualizer = new VideoCameraVisualizer();
                _videoCameraVisualizer.SetSource(_videoCamera);
            }
            catch (Exception)
            {
                isInitialized = false;
                MessageBox.Show("your phone doesn't suport this app!");
            }
        }