Пример #1
0
        public bool IsFirstTimeOpeningApplication()
        {
            bool returnValue = true;

            IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;

            if (appSettings.Count() > 0)
            {
                returnValue = false;
            }

            return(returnValue);
        }
Пример #2
0
        private void LoadSettings()
        {
            try
            {
                IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;

                if (appSettings.Count() > 3)
                {
                    //Flash
                    if (appSettings.Contains("flashon"))
                    {
                        bool flashOn = (bool)appSettings["flashon"];
                        if (flashOn)
                        {
                            FlashOn  = true;
                            FlashOff = false;
                        }
                        else
                        {
                            FlashOff = true;
                            FlashOn  = false;
                        }
                    }

                    //camera location
                    if (appSettings.Contains("frontcameraselected"))
                    {
                        bool frontCamSelected = (bool)appSettings["frontcameraselected"];
                        if (frontCamSelected)
                        {
                            FrontCamera = true;
                            BackCamera  = false;
                        }
                        else
                        {
                            BackCamera  = true;
                            FrontCamera = false;
                        }
                    }

                    if (appSettings.Contains("selectedresolution"))
                    {
                        //picture resolution
                        string selectedResolution = (string)appSettings["selectedresolution"];
                        foreach (Resolution row in AvailableResolutions)
                        {
                            if (row.Display == selectedResolution)
                            {
                                SelectedResolution = row;
                            }
                        }
                        //set resolution to default if there is no resolution
                        if (SelectedResolution == null)
                        {
                            SelectedResolution = AvailableResolutions[AvailableResolutions.Count() - 1];
                        }
                    }

                    if (appSettings.Contains("mainscreenimage"))
                    {
                        //main image
                        string mainImage = (string)appSettings["mainscreenimage"];
                        if (mainImage != null)
                        {
                            foreach (var row in ScreenShots)
                            {
                                if (row.Name == mainImage)
                                {
                                    SelectedScreenShot = row;
                                }
                            }
                        }
                    }

                    if (appSettings.Contains("soundon"))
                    {
                        //sound on or off
                        bool sound = (bool)appSettings["soundon"];
                        if (sound)
                        {
                            SoundOn  = true;
                            SoundOff = false;
                        }
                        else
                        {
                            SoundOff = true;
                            SoundOn  = false;
                        }
                    }

                    if (appSettings.Contains("picturecountvisibilityon"))
                    {
                        //sound on or off
                        bool picCntVis = (bool)appSettings["picturecountvisibilityon"];
                        if (picCntVis)
                        {
                            PictureCountVisibilityOn  = true;
                            PictureCountVisibilityOff = false;
                        }
                        else
                        {
                            PictureCountVisibilityOff = true;
                            PictureCountVisibilityOn  = false;
                        }
                    }

                    if (appSettings.Contains("focuson"))
                    {
                        //focus
                        bool focusOn = (bool)appSettings["focuson"];
                        if (focusOn)
                        {
                            FocusOn  = true;
                            FocusOff = false;
                        }
                        else
                        {
                            FocusOff = true;
                            FocusOn  = false;
                        }
                    }
                }
                else
                {
                    FlashOn     = false;
                    SoundOn     = false;
                    FlashOff    = true;
                    SoundOff    = true;
                    FocusOff    = false;
                    FocusOn     = true;
                    FrontCamera = false;
                    BackCamera  = true;
                    PictureCountVisibilityOn  = true;
                    PictureCountVisibilityOff = false;
                }
            }
            catch (Exception ex)
            {
            }
        }