Пример #1
0
        /// <summary>
        /// Для возможности задания стандартной начальной страницы(если есть токе, или если его нет)
        /// </summary>
        void SetupUriMapper()
        {
            // Get the UriMapper from the app.xaml resources, and assign it to the root frame
            UriMapper mapper = Resources["mapper"] as UriMapper;

            RootFrame.UriMapper = mapper;


            if (settings.Contains("access_token") && settings.Contains("user_id"))
            {
                MyUserData.user_id      = (int)settings["user_id"];
                MyUserData.access_token = (string)settings["access_token"];
                if (MyUserData.user_id != 0 && MyUserData.access_token != null)
                {
                    mapper.UriMappings[0].MappedUri = new Uri("/Pages/Conversation.xaml", UriKind.Relative);
                }
                else
                {
                    mapper.UriMappings[0].MappedUri = new Uri("/Login.xaml", UriKind.Relative);
                }
            }
            else // выполняет при самом первом запуске приложения(создаем начальный словарь)
            {
                //MyUserData.user_id = 0;
                //if (!settings.Contains("access_token") && !settings.Contains("user_id"))
                //{
                settings.Add("access_token", null);
                settings.Add("user_id", 0);
                //}

                mapper.UriMappings[0].MappedUri = new Uri("/Login.xaml", UriKind.Relative);
            }
        }
Пример #2
0
        /// <summary>
        /// Start authenticating the user by getting the auth token and then sending them off to the browser to authenticate with Readability.
        /// </summary>
        internal async void BeginAuth()
        {
            IsolatedStorageSettings isss = IsolatedStorageSettings.ApplicationSettings;

            if (AccessToken == null || AccessToken == "")
            {
                var client = new RestClient(ApiBaseUrl);
                client.Authenticator = OAuth1Authenticator.ForRequestToken(ConsumerKey, ConsumerSecret);
                var request  = new RestRequest("oauth/request_token");
                var response = await client.ExecuteTaskAsync(request);

                OAuthToken       = Utilities.GetQueryParameter(response.Content, "oauth_token");
                OAuthTokenSecret = Utilities.GetQueryParameter(response.Content, "oauth_token_secret");

                if (isss.Contains("oath_token"))
                {
                    isss.Remove("oauth_token");
                }
                if (isss.Contains("oauth_token_secret"))
                {
                    isss.Remove("oauth_token_secret");
                }
                isss.Add("oauth_token", OAuthToken);
                isss.Add("oauth_token_secret", OAuthTokenSecret);
                isss.Save();

                string authorizeUrl = ApiBaseUrl + "oauth/authorize?oauth_token=" + OAuthToken + "&oauth_callback=nowreadable:Home";
                await Launcher.LaunchUriAsync(new Uri(authorizeUrl));
            }
        }
Пример #3
0
 /// <summary>
 /// Agent zum Ausführen einer geplanten Aufgabe
 /// </summary>
 /// <param name="task">
 /// Die aufgerufene Aufgabe
 /// </param>
 /// <remarks>
 /// Diese Methode wird aufgerufen, wenn eine regelmäßige oder ressourcenintensive Aufgabe aufgerufen wird
 /// </remarks>
 protected override void OnInvoke(ScheduledTask task)
 {
     curTask = task;
     //TODO: Code zum Ausführen der Aufgabe im Hintergrund hinzufügen
     if (_settingsFile.Contains("mode") != true)
     {
         NotifyComplete();
     }
     if ((int)_settingsFile["mode"] == 0)
     {
         _dayStr = " heute ";
     }
     else if ((int)_settingsFile["mode"] == 1)
     {
         _dayStr = " morgen ";
     }
     _fetcher = new Fetcher((int)_settingsFile["mode"]);
     _fetcher.RaiseErrorMessage += (sender, e) =>
     {
         Stop();
     };
     _fetcher.RaiseRetreivedScheduleItems += (sender, e) =>
     {
         Proceed(e.Schedule);
     };
     if (_settingsFile.Contains("group"))
     {
         _fetcher.GetTimes((int)_settingsFile["group"] + 1);
     }
     else
     {
         Stop();
     }
 }
Пример #4
0
        /// <summary>
        /// Update a setting value for our application. If the setting does not
        /// exist, then add the setting.
        /// </summary>
        /// <param name="Key"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        private bool AddOrUpdateValue(string Key, Object value)
        {
            bool valueChanged = false;

            // If the key exists
            if (settings.Contains(Key))
            {
                // If the value has changed
                if (settings[Key] != value)
                {
                    // Store the new value
                    settings[Key] = value;
                    this.settings.Save();
                    valueChanged = true;
                }
            }
            // Otherwise create the key.
            else
            {
                settings.Add(Key, value);
                this.settings.Save();
                valueChanged = true;
            }

            ////GoogleAnalytics.EasyTracker.GetTracker().SendEvent("Settings changed", Key + " set to " + value.ToString(), string.Empty, 0);
            return(valueChanged);
        }
Пример #5
0
 void save_Click(object sender, EventArgs e)
 {
     if (appsettings.Contains("ovolacto"))
     {
         appsettings.Remove("ovolacto");
     }
     if (appsettings.Contains("vegan"))
     {
         appsettings.Remove("vegan");
     }
     if (appsettings.Contains("gf"))
     {
         appsettings.Remove("gf");
     }
     if (appsettings.Contains("passover"))
     {
         appsettings.Remove("passover");
     }
     appsettings.Add("ovolacto", ovolactoBox.IsChecked);
     appsettings.Add("vegan", veganBox.IsChecked);
     appsettings.Add("gf", gfBox.IsChecked);
     appsettings.Add("passover", passoverBox.IsChecked);
     (App.Current as App).ovoFilter      = (bool)ovolactoBox.IsChecked;
     (App.Current as App).veganFilter    = (bool)veganBox.IsChecked;
     (App.Current as App).gfFilter       = (bool)gfBox.IsChecked;
     (App.Current as App).passoverFilter = (bool)passoverBox.IsChecked;
     appsettings.Save();
     NavigationService.GoBack();
 }
Пример #6
0
 private void LoadSettings()
 {
     if (settings.Contains(SettingLastUpdated))
     {
         App.ViewModel.LastUpdated = (DateTime)settings[SettingLastUpdated];
     }
 }
Пример #7
0
        /// <summary>
        /// When Webservice completes writing userID to the DB and returns the id
        /// writes it to Isolated Storage on user disk
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void client_AddParticipantCompleted(object sender, ServiceReference1.AddParticipantCompletedEventArgs e)
        {
            // SubmitExperimentBtn.Visibility = Visibility.Visible;
            int userID;

            if (e.Error == null)
            {
                userID = e.Result;
                // Write user ID to IsolatedStorage
                if (!i_storage.Contains("userID"))
                {
                    i_storage.Add("userID", userID);
                    //   SubmitExperimentBtn.Content = "if" + i_storage["userID"].ToString() ;
                }
                else
                {
                    i_storage.Remove("userID");
                    i_storage.Add("userID", userID);

                    //  SubmitExperimentBtn.Content = "else" + i_storage["userID"].ToString();
                }
            }
            //SubmitExperimentBtn.Visibility = System.Windows.Visibility.Visible;
            //SubmitExperimentBtn.Content = e.Result.ToString()+"here";
        }
Пример #8
0
        //确认修改
        private void IconButton_Click(object sender, EventArgs e)
        {
            textBoxDay_LostFocus(null, null);
            string msg  = textBoxMsg.Text;
            int    days = Convert.ToInt32(textBoxDay.Text);

            if (days < 1)
            {
                return;
            }
            //if (days < 1)
            //{
            //    MessageBox.Show("请设置一个大于今天的日期");
            //    return;
            //}
            isActived = true;
            DateTime date = datePickerDate.Value.Value;

            updateIsolate(msg, date);
            updateAgent();
            if (!isoSetting.Contains("isActived"))
            {
                isoSetting.Add("isActived", true);
            }
            updateTile(msg, days);
            if (!isFirstTime)
            {
                MessageBox.Show("磁贴已设置");
            }
        }
Пример #9
0
        private void Initialize()
        {
            AllHighScores = new HighScoreList();

            if (g_IsolatedStore.Contains(LastHighScoreUpdateKey))
            {
                AllHighScores.LastHighScoreUpdate = (DateTime)g_IsolatedStore[LastHighScoreUpdateKey];
            }

            using (IsolatedStorageFile fileSystem = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (!fileSystem.FileExists(HighScoresSaveFileName))
                {
                    AllHighScores.HighScores = new List <HighScoreItemViewModel>();
                }
                else
                {
                    using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream(HighScoresSaveFileName, FileMode.Open, fileSystem))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(List <HighScoreItemViewModel>));
                        AllHighScores.HighScores = serializer.Deserialize(fs) as List <HighScoreItemViewModel>;
                    }
                }
            }
        }
Пример #10
0
        /// <summary>
        /// Update a setting value. If the setting does not, then add the setting.
        /// </summary>
        private static bool AddOrUpdateValue(string key, Object value)
        {
            lock (locker)
            {
                bool valueChanged = false;

                if (settings.Contains(key))
                {
                    if (settings[key] != value)
                    {
                        settings[key] = value;
                        valueChanged  = true;
                    }
                }
                else
                {
                    settings.Add(key, value);
                    valueChanged = true;
                }
                if (valueChanged)
                {
                    settings.Save();
                }
                return(valueChanged);
            }
        }
Пример #11
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            // First, check to make sure we're note returning
            // from an interrupted session, redirected from
            // MainPage.xaml.  We'll check IsolatedStorageSettings.


            string state = "";

            if (settings.Contains("state"))
            {
                if (settings.TryGetValue <string>("state", out state))
                {
                    if (state == "add")
                    {
                        string value = "";
                        if (settings.Contains("value"))
                        {
                            if (settings.TryGetValue <string>("value", out value))
                            {
                                editTextBox.Text = value;
                            }
                        }
                    }
                }
            }

            settings["state"] = "add";
            settings["value"] = editTextBox.Text;
            editTextBox.Focus();
            editTextBox.SelectionStart = editTextBox.Text.Length;
        }
Пример #12
0
        private void BtnConfirmaCidade_Click(object sender, RoutedEventArgs e)
        {
            //Cria um objeto da classe IsolatedStorageSettings para armazenamento das chaves
            IsolatedStorageSettings iso = IsolatedStorageSettings.ApplicationSettings;

            if ((bool)ckbLembrar.IsChecked)
            {
                //É necessário perguntar se a chave já existe para evitar que se crie chaves duplicadas, o que fatalmente irá provocar erros
                if (iso.Contains("login.Cidade")) //Apenas atualiza os valores das chaves
                {
                    iso["login.Cidade"] = TxtCidade.Text;
                    iso["login.Uf"]     = TxtUf.Text;
                }
                else //Cria novas chaves
                {
                    iso.Add("login.Cidade", TxtCidade.Text);
                    iso.Add("login.Uf", TxtUf.Text);
                }
                iso.Save(); //Necessário para armazenar os valores das chaves
            }
            else
            {
                //Caso o usuário não queira mais armazenar suas credenciais, podemos remover as chaves
                if (iso.Contains("login.Cidade"))
                {
                    iso.Remove("login.Cidade");
                    iso.Remove("login.Uf");
                }
            }
            //Direciona o usuário para uma página qualquer, caso ele acerte o login
            //NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            NavigationService.Navigate(new Uri("/PaginaInicial.xaml", UriKind.Relative));
        }
Пример #13
0
        /// <summary>
        /// Update a setting in the application settings store
        /// </summary>
        /// <param name="Name">Name of the setting to update</param>
        /// <param name="Value">New value to be saved for the named setting</param>
        /// <returns>true if Value is changed, otherwise false</returns>
        public bool UpdateSetting(string Name, Object Value)
        {
            bool changed = false;

            if (settingsStore.Contains(Name))
            {
                if (settingsStore[Name] != Value)
                {
                    NotifyPropertyChanging(Name);
                    settingsStore[Name] = Value;
                    NotifyPropertyChanged(Name);
                    changed = true;
                }
            }
            else
            {
                if (defaults[Name] != Value)
                {
                    NotifyPropertyChanging(Name);
                    settingsStore.Add(Name, Value);
                    NotifyPropertyChanged(Name);
                    changed = true;
                }
            }
            return(changed);
        }
Пример #14
0
        private void btnAcesso_Click(object sender, RoutedEventArgs e)
        {
            IsolatedStorageSettings iso = IsolatedStorageSettings.ApplicationSettings;

            if (txtUsuario.Text == "admin" && txtSenha.Password == "123")
            {
                if ((bool)ckbLembrar.IsChecked)
                {
                    if (iso.Contains("login.Usuario"))
                    {
                        iso["login.Usuario"] = txtUsuario.Text;
                        iso["login.Senha"]   = txtSenha.Password;
                    }
                    else
                    {
                        iso.Add("login.Usuario", txtUsuario.Text);
                        iso.Add("login.Senha", txtSenha.Password);
                    }
                    iso.Save();
                }
                else
                {
                    if (iso.Contains("login.Usuario"))
                    {
                        iso.Remove("login.Usuario");
                        iso.Remove("login.Senha");
                    }
                }

                NavigationService.Navigate(new Uri("/Notepad.xaml", UriKind.Relative));

                //MessageBox.Show("Acesso Concedido!");
            }
        }
Пример #15
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (!appSettings.Contains("usingLiveTile"))
            {
                appSettings["usingLiveTile"] = true;
                appSettings.Save();
            }

            usingLiveTile = (Boolean)(appSettings["usingLiveTile"]);
            UpdateLiveTileButton.IsEnabled = usingLiveTile;
            LiveTileCheckBox.IsChecked     = usingLiveTile;

            if (!appSettings.Contains("usingCustomHost"))
            {
                appSettings["usingCustomHost"] = false;
                appSettings.Save();
            }

            if (!appSettings.Contains("customHost"))
            {
                appSettings["customHost"] = "omeddle.now.im";
                appSettings.Save();
            }

            usingCustomHost = (Boolean)(appSettings["usingCustomHost"]);
            customHost      = (string)(appSettings["customHost"]);
            CustomHostContentControl.IsEnabled = usingCustomHost;
            CustomHostTextBox.Text             = customHost;
            CustomHostCheckBox.IsChecked       = usingCustomHost;
        }
        /// <summary>
        /// Update a setting value for our application. If the setting does not
        /// exist, then add the setting.
        /// </summary>
        /// <param name="Key"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static bool AddOrUpdateValue(string Key, Object value)
        {
            bool valueChanged = false;

            // If the key exists
            if (settings.Contains(Key))
            {
                // If the value has changed
                if (settings[Key] != value)
                {
                    // Store the new value
                    settings[Key] = value;
                    valueChanged  = true;
                }
            }
            // Otherwise create the key.
            else
            {
                settings.Add(Key, value);
                valueChanged = true;
            }

            //settings.Save();

            return(valueChanged);
        }
Пример #17
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            recentChatList = new ObservableCollection <Chat>();
            if (appSettings.Contains("recents"))
            {
                recentChatList = appSettings["recents"] as ObservableCollection <Chat>;
            }
            else
            {
                appSettings["recents"] = recentChatList;
                appSettings.Save();
            }

            RecentChatList.ItemsSource = recentChatList;

            savedChatList = new ObservableCollection <Chat>();
            if (appSettings.Contains("savedchats"))
            {
                savedChatList = appSettings["savedchats"] as ObservableCollection <Chat>;
            }
            else
            {
                appSettings["savedchats"] = savedChatList;
                appSettings.Save();
            }

            SavedChatList.ItemsSource = savedChatList;
        }
Пример #18
0
        public MainPage()
        {
            InitializeComponent();
            imglists = new ObservableCollection <ImgList>();
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (!settings.Contains("photolen"))
            {
                settings.Add("photolen", "0");
            }
            if (!settings.Contains("navchk"))
            {
                settings.Add("navchk", "0");
            }
            else
            {
                if (settings["navchk"] as string != "0")
                {
                    LoadActivePhotos();
                }
            }

            imglist.ItemsSource = imglists;
            //GetLockScreenPermission();
            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
Пример #19
0
 public void AddAds(Grid grid, string adUnitID)
 {
     try
     {
         const string product = "productRemoveAds";
         if (!settings.Contains(product))
         {
             AdView bannerAd = new AdView
             {
                 Format   = AdFormats.Banner,
                 AdUnitID = adUnitID
             };
             AdRequest adRequest = new AdRequest();
             //adRequest.ForceTesting = true;
             if (grid != null)
             {
                 grid.Children.Add(bannerAd);
                 bannerAd.LoadAd(adRequest);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Пример #20
0
        public Boolean createUser(User user)
        {
            if (appSettings.Contains(KEY_FIRSTNAME))
            {
                appSettings.Remove(KEY_FIRSTNAME);
                appSettings.Remove(KEY_LASTNAME);
                appSettings.Remove(KEY_ADDRESS);
                appSettings.Remove(KEY_PHONENUMBER);
                appSettings.Remove(KEY_USERNAME);
                appSettings.Remove(KEY_PASSWORD);
            }

            try
            {
                Debug.WriteLine("" + user.toString());
                appSettings.Add(KEY_FIRSTNAME, user.Firstname);
                appSettings.Add(KEY_LASTNAME, user.Lastname);
                appSettings.Add(KEY_ADDRESS, user.Address);
                appSettings.Add(KEY_PHONENUMBER, user.Phonenumber);
                appSettings.Add(KEY_USERNAME, user.Username);
                appSettings.Add(KEY_PASSWORD, user.Password);
                appSettings.Save();
                dummyDBStatus = true;
            }
            catch (IsolatedStorageException)
            {
                dummyDBStatus = false;
                Debug.WriteLine("you are here");
            }
            return(dummyDBStatus);
        }
Пример #21
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            String id;

            if (NavigationContext.QueryString.TryGetValue("si", out id))
            {
                ListId = int.Parse(id);
                BikeStopViewModel stop     = App.ViewModel.Items[ListId];
                GeoCoordinate     location = new GeoCoordinate(stop.Latitude, stop.Longitude);
                StopId                = stop.Id;
                BikeStopName.Text     = stop.Name;
                BikeStopMap.Center    = location;
                BikeStopDistrict.Text = stop.District;
                BikeStopAddress.Text  = stop.Address;

                TargetMarker.Location   = location;
                TargetMarker.Content    = stop.Name;
                TargetMarker.Visibility = Visibility.Visible;

                if (!appSettings.Contains(Constants.TRACKING) || (bool)appSettings[Constants.TRACKING])
                {
                    watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
                    watcher.MovementThreshold = 20; // 20 meters
                    watcher.PositionChanged  += new EventHandler <GeoPositionChangedEventArgs <GeoCoordinate> >(OnPositionChanged);
                    watcher.Start();
                }

                BuildLocalizedApplicationBar();

                LoadAvailability(StopId);
            }
        }
Пример #22
0
        /// <summary>
        /// Persists mru maps to disc in isolated storage settings.
        /// </summary>
        static void Save()
        {
            if (!IsolatedStorageFile.IsEnabled)
            {
                return;
            }

            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            //clear existing settings
            for (int i = 0; i < _maxAmount; ++i)
            {
                if (settings.Contains(_mru + i))
                {
                    settings.Remove(_mru + i);
                }
            }

            //save each id as individual setting
            int    index = 0;
            string key   = _mru + index;

            foreach (ContentItem item in _contentItems)
            {
                if (!settings.Contains(key))
                {
                    settings.Add(_mru + index, item.Id);
                }
                else
                {
                    settings[key] = item.Id;
                }
                ++index;
            }
        }
Пример #23
0
        private void PhoneApplicationPage_Loaded_1(object sender, RoutedEventArgs e)
        {
            string state = "";

            if (settings.Contains("state"))
            {
                if (settings.TryGetValue <string>("state", out state))
                {
                    if (state == "add")
                    {
                        string value = "";
                        if (settings.Contains("value"))
                        {
                            if (settings.TryGetValue <string>("value", out value))
                            {
                                editTextBox.Text = value;
                            }
                        }
                    }
                }
                settings["state"] = "add";
                settings["value"] = editTextBox.Text;
                editTextBox.Focus();
                editTextBox.SelectionStart = editTextBox.Text.Length;
            }
        }
Пример #24
0
        private void LoadIsolatedStorage()
        {
            if (isoData.Contains("lstSchedule"))
            {
                lstSchedule = (List <Models.Schedules>)isoData["lstSchedule"];
                Dispatcher.BeginInvoke(DisplayPresenters);
            }
            else
            {
                lstSchedule = new List <Models.Schedules>();
                isoData.Add("lstSchedule", lstSchedule);
            }

            if (isoData.Contains("lastPulledSchedule"))
            {
                lastPulled = (DateTime)isoData["lastPulledSchedule"];
            }

            isoData.Save();

            if (NetworkInterface.GetIsNetworkAvailable() && lastPulled.AddDays(.25) <= DateTime.Now)
            {
                var wc = new WebClient();
                wc.DownloadStringCompleted += this.DownloadStringCompleted;
                wc.DownloadStringAsync(new Uri("http://www.chicagocodecamp.com/api/Schedules/" + EventId + "?json=true", UriKind.RelativeOrAbsolute));
            }
        }
Пример #25
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }

            if (!appSettings.Contains(Constants.LOCATION_CONSENT))
            {
                MessageBoxResult result = MessageBox.Show(AppResources.LocationConsent,
                                                          AppResources.LocationConsentCaption, MessageBoxButton.OKCancel);
                if (result == MessageBoxResult.OK)
                {
                    appSettings[Constants.LOCATION_CONSENT] = true;
                }
                else
                {
                    appSettings[Constants.LOCATION_CONSENT] = false;
                }

                appSettings.Save();
            }

            // fav items
            FavoriteItems.Clear();
            if (appSettings.Contains(Constants.FAVORITED_LIST))
            {
                List <int> favs = (List <int>)appSettings[Constants.FAVORITED_LIST];
                foreach (int favId in favs)
                {
                    FavoriteItems.Add(App.ViewModel.Items[favId]);
                }
            }
        }
Пример #26
0
        /// <summary>
        /// Loads the stored values from the isolated storage and sets them to the HTML5 UI.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void webBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            string measuredLength       = "-1";
            string measuredAngleRadians = "-1";
            string screenWidthMM        = "81"; // Default for Lumia 800
            string useMM = "true";

            if (m_settings.Contains(MEASURED_LENGTH_KEY))
            {
                measuredLength = (string)m_settings[MEASURED_LENGTH_KEY];
            }

            if (m_settings.Contains(MEASURED_ANLGE_RADIANS_KEY))
            {
                measuredAngleRadians = (string)m_settings[MEASURED_ANLGE_RADIANS_KEY];
            }

            if (m_settings.Contains(SCREEN_WIDTH_MM))
            {
                screenWidthMM = (string)m_settings[SCREEN_WIDTH_MM];
            }

            if (m_settings.Contains(USE_MM))
            {
                useMM = (string)m_settings[USE_MM];
            }

            webBrowser.InvokeScript("eval", string.Format("measuredLength = {0};", measuredLength));
            webBrowser.InvokeScript("eval", string.Format("measuredAngleRadians = {0};", measuredAngleRadians));
            webBrowser.InvokeScript("eval", string.Format("screenWidthMM = {0};", screenWidthMM));
            webBrowser.InvokeScript("eval", string.Format("useMM = {0};", useMM));
            webBrowser.InvokeScript("eval", "init();");
        }
Пример #27
0
        public Page1()
        {
            InitializeComponent();

            if (!settings.Contains("hostname"))
            {
                settings.Add("hostname", "localhost");
            }

            if (!settings.Contains("port"))
            {
                settings.Add("port", "8080");
            }

            txt_hostname.Text = settings["hostname"].ToString();
            txt_port.Text     = settings["port"].ToString();


            InputScopeNameValue digitInputScopeNameValue = InputScopeNameValue.TelephoneNumber;

            txt_port.InputScope = new InputScope()
            {
                Names = { new InputScopeName()
                          {
                              NameValue = digitInputScopeNameValue
                          } }
            };
        }
 public void load()
 {
     if (settings.Contains(DeviceDbKey))
     {
         gestureToContactMap = ((Dictionary <string, ContactData>)settings[DeviceDbKey]);
     }
 }
        private void setlocationButton_Click(object sender, RoutedEventArgs e)
        {
            bool b = false;

            if (setlocationButton.Content.ToString() == "off")
            {
                var result = MessageBox.Show("Turn location service off successfully!");
                if (result == MessageBoxResult.OK)
                {
                    setlocationButton.Content = "on";
                    Dataclass.status          = "cancel";
                    b = true;
                }
                if (_appSettings.Contains("status"))
                {
                    _appSettings["status"] = null;
                    _appSettings.Save();
                }
            }
            if (setlocationButton.Content.ToString() == "on" && b == false)
            {
                var result = MessageBox.Show("Turn location service on successfully!");
                if (result == MessageBoxResult.OK)
                {
                    setlocationButton.Content = "off";
                    Dataclass.status          = "ok";
                }
                if (_appSettings.Contains("status"))
                {
                    _appSettings["status"] = "ok";
                    _appSettings.Save();
                }
            }
        }
Пример #30
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.IsNavigationInitiator == false && e.NavigationMode == NavigationMode.Back)
     {
         int i = 1;
         if (!settings.Contains("ad"))
         {
             settings.Add("ad", DateTime.Now.ToString("yyyy/mm/dd"));
             settings.Save();
             SetHIDE();
         }
         else
         {
             string k = (string)settings["ad"];
             if (k == DateTime.Now.ToString("yyyy/mm/dd"))
             {
                 SetHIDE();
             }
         }
     }
     if (e.NavigationMode == NavigationMode.New)
     {
         if (settings.Contains("ad"))
         {
             string k = (string)settings["ad"];
             if (k == DateTime.Now.ToString("yyyy/mm/dd"))
             {
                 SetHIDE();
             }
         }
     }
     base.OnNavigatedTo(e);
 }