async private void GetDataFromWeb()
        {
            progressbar.Text = "Fetching new data";
            progressbar.ShowAsync();

            var client = new HttpClient();

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (!localSettings.Containers.ContainsKey("userInfo"))
            {
                MessageDialog msgbox = new MessageDialog("Please log-in first. Go to settings from the main menu.");
                await msgbox.ShowAsync();

                return;
            }

            var lastcheck = localSettings.Containers["userInfo"].Values["lastcheckexamples"].ToString();

            Debug.WriteLine(System.Uri.EscapeUriString(lastcheck));
            var response = await client.GetAsync(new Uri("http://codeinn-acecoders.rhcloud.com:8000/query/data?Timestamp=" + System.Uri.EscapeUriString(lastcheck) + "&Table=Examples"));

            var result = await response.Content.ReadAsStringAsync();

            result = result.Trim(new Char[] { '"' });
            Debug.WriteLine(result);

            DatabaseExample Db_Helper = new DatabaseExample();

            try
            {
                List <Examples> newex = JsonConvert.DeserializeObject <List <Examples> >(result);
                foreach (Examples ex in newex)
                {
                    try
                    {
                        Db_Helper.InsertExample(ex);
                    }
                    catch
                    {
                        Debug.WriteLine("DB error for item of id: " + ex.Id);
                    }
                }

                localSettings.Containers["userInfo"].Values["lastcheckexamples"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                progressbar.Text = "New items";
            }
            catch
            {
                Debug.WriteLine("No new items");
                progressbar.Text = "No New items";
            }
            finally
            {
                ReadExamples dbproblems = new ReadExamples();
                DB_ExampleList      = dbproblems.GetAllExamples();
                listBox.ItemsSource = DB_ExampleList.OrderByDescending(i => i.Id).ToList();
            }
            progressbar.HideAsync();
        }
示例#2
0
        private async void stopFan_Checked(object sender, RoutedEventArgs e)
        {
            Models.Thermostat target = DeviceCarousel.SelectedItem as Models.Thermostat;
            if (null == target)
            {
                return;
            }
            target.FanStop = stopFan.IsChecked.Value;

            if (target.fan_timer_active)
            {
                ThermostatAPI api = Global.Instance.ThermostatAPI;

                Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                string token = localSettings.Values["NestAccessToken"] as string;

                Task <string> t = Task.Run(async() => await api.SetFanOff(target.Reference));
                t.Wait();

                if (t.Result.Contains("error"))
                {
                    var dialog = new MessageDialog(api.ErrorMessage);
                    await dialog.ShowAsync();

                    if (api.AuthorizationError)
                    {
                        ViewModel.ToSettingButtonClickedCommand.Execute(null);
                    }
                }
                else
                {
                    target.fan_timer_active = false;
                }
            }
        }
        async Task UnAssignAsync()
        {
            //client.BaseAddress = new Uri("http://tamasdeep1624-eval-test.apigee.net/proxyfleetapi");
            //client.DefaultRequestHeaders.Accept.Clear();
            //client.DefaultRequestHeaders.Add("apikey", "NbqYQDjspLDvorREUZAnyHZyCC3GoPGs");

            //HttpContent content;
            HttpResponseMessage response;
            ShipmentOrder       shipmentorder = shipmentOrderdataGrid.SelectedItem as ShipmentOrder;

            Debug.WriteLine(client.DefaultRequestHeaders);
            Debug.WriteLine("shipment " + shipmentorder.ShipmentId);
            shipmentorder.DriverId  = null;
            shipmentorder.TruckId   = null;
            shipmentorder.TrailerId = null;
            string json = JsonConvert.SerializeObject(shipmentorder);

            Debug.WriteLine(json);
            HttpContent content;

            content  = new StringContent(json, Encoding.UTF8, "application/json");
            response = await client.PutAsync("http://fleetapi-dev.us-east-1.elasticbeanstalk.com/api/ShipmentOrders/" + shipmentorder.Id, content);

            Debug.WriteLine(response);
            if (response.IsSuccessStatusCode)
            {
                Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                int brokerID = (int)localSettings.Values["brokerID"];
                await InitAssignedshipmentOrdergrid(brokerID);

                success.Text       = "Successfully Remove Driver From Shipment Order";
                success.Visibility = Visibility.Visible;
            }
        }
示例#4
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            //Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
            //    Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
            //    Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            // ***********************************************
            // load values from local settings
            // ***********************************************
            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (HorseName == string.Empty) HorseName = Convert.ToString(localSettings.Values["HorseNameField"]);
            if (SessionID == string.Empty) SessionID = Guid.NewGuid().ToString(); //Convert.ToString(localSettings.Values["SessionIDField"]);

            if (ServiceBusNamespace == null) ServiceBusNamespace = Convert.ToString(localSettings.Values["ServiceBusNamespaceField"]);
            if (EventHubName == null) EventHubName = Convert.ToString(localSettings.Values["EventHubNameField"]);
            if (SharedAccessPolicyName == null) SharedAccessPolicyName = Convert.ToString(localSettings.Values["SharedAccessPolicyNameField"]);
            if (SharedAccessPolicyKey == null) SharedAccessPolicyKey = Convert.ToString(localSettings.Values["SharedAccessPolicyKeyField"]);
            if (SensorName == null) SensorName = Convert.ToString(localSettings.Values["SensorNameField"]);
            if (HorseName == null) HorseName = Convert.ToString(localSettings.Values["HorseNameField"]);

            Messages = "";

            getVersionNumberOfApp();
        }
示例#5
0
        public static async Task call_back_process_alldata(string msg, object obj)
        {
            DebugTool.Log("call back of all data------" + msg);
            CommonRet o = (CommonRet)getJsonObj(msg);

            if (o == null || o.flag == null)
            {
                return;
            }
            if (o.flag.Equals("1"))
            {
                Windows.Storage.ApplicationDataContainer settings = Windows.Storage.ApplicationData.Current.LocalSettings;

                ApplicationSettings.RemoveSetting(SettingKeys.CLIENT_DATA);
                ApplicationSettings.RemoveSetting(SettingKeys.EVENT_DATA);
                //ApplicationSettings.RemoveSetting(SettingKeys.ERROR_DATA);
                ApplicationSettings.RemoveSetting(SettingKeys.PAGE_INFO);
                ApplicationSettings.RemoveSetting(SettingKeys.HAS_DATA_TO_SEND);

                await ApplicationSettings.RemoveSettingFromXmlFileAsync(SettingKeys.CLIENT_DATA);

                await ApplicationSettings.RemoveSettingFromXmlFileAsync(SettingKeys.EVENT_DATA);

                //ApplicationSettings.RemoveSettingFromXmlFileAsync(SettingKeys.ERROR_DATA);
                await ApplicationSettings.RemoveSettingFromXmlFileAsync(SettingKeys.PAGE_INFO);

                //ApplicationSettings.RemoveSetting(SettingKeys.HAS_DATA_TO_SEND);

                CrashListener.RemoveErrorLog();

                DebugTool.Log("delete file success!");
            }
        }
示例#6
0
        public static string GetFriendlyDate(DateTimeOffset d)
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            var    elapsed      = DateTimeOffset.Now - d;
            string returnformat = Enum.Parse <TimeStyle>(localSettings.Values["datetimeformat"].ToString()) == TimeStyle.Application ? "D" : "g";

            if (elapsed.TotalDays > 7)
            {
                return(d.ToString(returnformat));
            }
            else if (elapsed.TotalDays > 1)
            {
                return($"{elapsed.Days} days ago");
            }
            else if (elapsed.TotalHours > 1)
            {
                return($"{elapsed.Hours} hours ago");
            }
            else if (elapsed.TotalMinutes > 1)
            {
                return($"{elapsed.Minutes} minutes ago");
            }
            else
            {
                return($"{elapsed.Seconds} seconds ago");
            }
        }
示例#7
0
        private async void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            Object value  = localSettings.Values["sessionUser"];
            var    client = new HttpClient();
            string getUri = string.Format("http://localhost:5000/api/Events/{0}", localSettings.Values["EventId"].ToString());
            var    uri    = new Uri(getUri);
            var    evento = new Event()
            {
                Id             = Convert.ToInt32(localSettings.Values["EventId"]),
                Title          = tb_Title.Text,
                Description    = tb_Description.Text,
                StartDate      = cdp_StartDate.Date.Value.DateTime,
                EndDate        = cdp_EndDate.Date.Value.DateTime,
                StartLatitude  = Convert.ToDouble(localSettings.Values["Event_startLatitude"]),
                EndLatitude    = Convert.ToDouble(localSettings.Values["Event_endLatitude"]),
                StartLongitude = Convert.ToDouble(localSettings.Values["Event_endLatitude"]),
                EndLongitude   = Convert.ToDouble(localSettings.Values["Event_endLongitude"]),
                StartTime      = tp_Start_Time.Time.ToString(),
                EndTime        = tp_End_Time.Time.ToString(),
                UserId         = int.Parse(value.ToString())
                                 //Username = value.ToString()
            };
            var           json       = JsonConvert.SerializeObject(evento);
            StringContent theContent = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
            await client.PutAsync(uri, theContent);

            var editDialog = new MessageDialog("Changes are saved!");
            await editDialog.ShowAsync();

            Frame?.Navigate(typeof(Details), evento);
        }
        async Task RunAsync()
        {
            //client.BaseAddress = new Uri("http://tamasdeep1624-eval-test.apigee.net/proxyfleetapi");
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            int   CarrierID = (int)localSettings.Values["CarrierID"];
            Truck truck     = new Truck {
                CarrierId = CarrierID, LicensePlate = license.Text, Make = make.Text, Vin = vinnum.Text, TruckType = trucktype.Text, Year = year.Text, Model = model.Text
            };

            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Add("apikey", "NbqYQDjspLDvorREUZAnyHZyCC3GoPGs");
            string json = JsonConvert.SerializeObject(truck);

            Debug.WriteLine(json);
            HttpContent         content;
            HttpResponseMessage response;

            content = new StringContent(json, Encoding.UTF8, "application/json");
            Debug.WriteLine(client.DefaultRequestHeaders);
            response = await client.PostAsync("http://tamasdeep1624-eval-test.apigee.net/proxyfleetapi/api/Trucks", content);

            if (response.IsSuccessStatusCode)
            {
                success.Text = "Successfully Added Truck";
            }
            Debug.WriteLine(response);
        }
示例#9
0
        public HomePage()
        {
            this.InitializeComponent();

            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            //StatusField.Text = "Please ensure the sensor is connected";

            app = App.Current as SensorTagReader.App;

            if (app.HorseName != null) HorseNameField.Text = app.HorseName;
            if (app.SessionID != null)
                SesssionIDField.Text = app.SessionID;
            else
                SesssionIDField.Text = _sessionID;


            tagReaders = new List<TagReaderService>();
            deviceInfoService = new DeviceInfoService();

            eventHubWriterTimer = new DispatcherTimer();
            eventHubWriterTimer.Interval = new TimeSpan(0, 0, 1);
            eventHubWriterTimer.Tick += OnEventHubWriterTimerTick;

        }
示例#10
0
        async Task CancelAsync()
        {
            //client.BaseAddress = new Uri("http://tamasdeep1624-eval-test.apigee.net/proxyfleetapi");
            //client.DefaultRequestHeaders.Accept.Clear();
            //client.DefaultRequestHeaders.Add("apikey", "NbqYQDjspLDvorREUZAnyHZyCC3GoPGs");

            //HttpContent content;
            HttpResponseMessage response;
            Shipment            shipment = inprogrssshipmentdataGrid.SelectedItem as Shipment;

            Debug.WriteLine(client.DefaultRequestHeaders);
            Debug.WriteLine("shipment " + shipment.Id);
            shipment.BrokerId = null;
            string json = JsonConvert.SerializeObject(shipment);

            Debug.WriteLine(json);
            HttpContent content;

            content  = new StringContent(json, Encoding.UTF8, "application/json");
            response = await client.PutAsync("http://fleetapi-dev.us-east-1.elasticbeanstalk.com/api/Shipments/" + shipment.Id, content);

            Debug.WriteLine(response);
            if (response.IsSuccessStatusCode)
            {
                Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                int customerid = (int)localSettings.Values["customerID"];
                //await RunAsync(customerid);
                success.Text       = "Successfully Canceled Shipment";
                success.Visibility = Visibility.Visible;
            }
        }
        private async void webviewChild1_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args)
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            string url      = webviewChild1.Source.AbsoluteUri;
            string skoleurl = (string)localSettings.Values["skoleurl"];
            string emuurl   = (string)localSettings.Values["emuloginurl"];

            if (url.Contains(skoleurl) && !url.Contains("parent") && !url.Contains("sso"))
            {
                string clickUnilogin = @"document.getElementsByTagName('a')[4].click();";
                await webviewChild1.InvokeScriptAsync("eval", new string[] { clickUnilogin });
            }
            else if (url.Contains(emuurl))
            {
                string commandscript = String.Format("if (document.getElementById('user') != null) document.getElementById('user').value = '{0}'; if (document.getElementById('pass') != null) document.getElementById('pass').value='{1}'; if (document.getElementsByTagName('form') != null) document.getElementsByTagName('form')[0].submit(); ", localSettings.Values["FIUsername"], localSettings.Values["FIPassword"]);
                await webviewChild1.InvokeScriptAsync("eval", new string[] { commandscript });
            }
            else if (url.Contains("Caroline"))
            {
                string urlChild2 = webviewChild2.Source.AbsoluteUri;
                if (urlChild2.Contains(skoleurl) && !urlChild2.Contains("parent") && !urlChild2.Contains("sso"))
                {
                    string clickUnilogin = @"document.getElementsByTagName('a')[4].click();";
                    await webviewChild2.InvokeScriptAsync("eval", new string[] { clickUnilogin });
                }
                string urlChild3 = webviewChild3.Source.AbsoluteUri;

                if (urlChild3.Contains(skoleurl) && !urlChild3.Contains("parent") && !urlChild3.Contains("sso"))
                {
                    string clickUnilogin = @"document.getElementsByTagName('a')[4].click();";
                    await webviewChild3.InvokeScriptAsync("eval", new string[] { clickUnilogin });
                }
            }
        }
示例#12
0
        private void bt_calcular(object sender, RoutedEventArgs e)
        {
            try
            {
                in_kmRodado.Text     = in_kmRodado.Text.Replace('.', ',');
                in_listrosGasto.Text = in_listrosGasto.Text.Replace('.', ',');

                double kmrodado     = Double.Parse(in_kmRodado.Text);
                double litrosGastos = Double.Parse(in_listrosGasto.Text);
                double resultado    = kmrodado / litrosGastos;
                String resultString = String.Format("{0:0.00}", resultado);
                tb_info.Text = "Consumo = " + resultString + " KM/L";


                in_kmRodado.Text     = String.Format("{0:0.00}", kmrodado);
                in_listrosGasto.Text = String.Format("{0:0.00}", litrosGastos);

                Windows.Storage.ApplicationDataContainer roamingSettings =
                    Windows.Storage.ApplicationData.Current.RoamingSettings;
                roamingSettings.Values["in_consumo"] = resultString;
            }
            catch (FormatException e1)
            {
                tb_info.Text = "Valor passado não é válido.";
            }
        }
示例#13
0
        private static void OnTextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            Windows.Storage.ApplicationDataContainer localSettings =
                Windows.Storage.ApplicationData.Current.LocalSettings;

            var control = sender as RichTextBlock;

            if (control != null)
            {
                control.Blocks.Clear();
                var paragraph = new Paragraph();

                List <TweetLinks> value = e.NewValue as List <TweetLinks>;
                foreach (var item in value)
                {
                    double TextFontSize = 18; // Настройка размера шрифта
                    if (localSettings.Values["FontSize"] != null)
                    {
                        TextFontSize = double.Parse(localSettings.Values["FontSize"].ToString()) + 2;
                    }

                    Hyperlink hyperlink = new Hyperlink();
                    hyperlink.NavigateUri = new Uri(item.short_link);
                    paragraph.Inlines.Add(new Run {
                        Text = item.text, FontSize = TextFontSize
                    });
                    hyperlink.Inlines.Add(new Run {
                        Text = item.hr_link, FontSize = TextFontSize
                    });
                    paragraph.Inlines.Add(hyperlink);
                }
                control.Blocks.Add(paragraph);
            }
        }
 private DispatcherTimer musicTimer = new DispatcherTimer(); // 用于倒计时
 public SettingPage()
 {
     this.InitializeComponent();
     localsettings  = Windows.Storage.ApplicationData.Current.LocalSettings;
     hardness.Value = int.Parse(localsettings.Values["hardness"].ToString());
     startTimerToPlayMusic();
 }
示例#15
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            try
            {
                string NightScoutJsonURL = "";
                Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                Windows.Storage.StorageFolder            localFolder   = Windows.Storage.ApplicationData.Current.LocalFolder;

                if (localSettings.Values["NightScoutJson"] != null)
                {
                    NightScoutJsonURL = localSettings.Values["NightScoutJson"].ToString();

                    BackgroundTaskDeferral deferral = taskInstance.GetDeferral();
                    nightScoutJson = await getJsonUpdate(new Uri(NightScoutJsonURL));

                    NightScoutJsonFeed.updateTile(nightScoutJson);
                    // Inform the system that the task is finished.
                    deferral.Complete();
                }
            }
            catch (Exception ex)
            {
                throw
                    //TODO: Add an App Unhandled Exception handler
            }
        }
示例#16
0
        //private Windows.Storage.StorageFile subredditlistfile;

        //public ObservableCollection<SampleDataItem> SubscribedSubreddits { get; set; }

        public SubredditManager()
        {
            Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
            this.roamingFolder = Windows.Storage.ApplicationData.Current.RoamingFolder;

            //this.SubscribedSubreddits = new ObservableCollection<SampleDataItem>();
        }
示例#17
0
        private async void StackPanel_Loaded(object sender, RoutedEventArgs e)
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            HttpClient client         = new HttpClient();
            string     getUri         = "http://localhost:5000/api/Invites";
            Uri        uri            = new Uri(getUri);
            string     getEvento      = "http://localhost:5000/api/Events";
            Uri        eventUri       = new Uri(getEvento);
            var        eventoResponse = await client.GetStringAsync(eventUri);

            var response = await client.GetStringAsync(uri);

            List <Invite> listInvites = JsonConvert.DeserializeObject <List <Invite> >(response);
            List <Event>  listEvents  = JsonConvert.DeserializeObject <List <Event> >(eventoResponse);
            var           invites     = listInvites.FindAll(x => x.InvitedId == int.Parse(localSettings.Values["sessionUser"].ToString()));

            try
            {
                lb_Events.ItemsSource = invites;
            }
            catch
            {
                // ignored
            }
            localSettings.Values["Allowed_to_Edit"] = false;
        }
示例#18
0
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     this.Suspending += OnSuspending;
     LocalSettings    = Windows.Storage.ApplicationData.Current.LocalSettings;
     LoginToken       = (string)LocalSettings.Values["LoginToken"];
 }
示例#19
0
        private (bool result, OAuthToken token) GetAuthTokenFromLocalStore()
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            var composite = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["AuthToken"];

            if (composite == null)
            {
                return(result : false, token : null);
            }

            return(
                result : true,
                token : new OAuthToken
            {
                AccessToken = (string)composite["AccessToken"],
                ExpiresIn = (int)composite["ExpiresIn"],
                Id = (string)composite["Id"],
                Plan = (string)composite["Plan"],
                RefreshToken = (string)composite["RefreshToken"],
                State = (string)composite["State"],
                TokenType = (string)composite["TokenType"],
                CreatedAt = (DateTimeOffset)composite["CreatedAt"]
            }
                );
        }
示例#20
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // TODO: Prepare page for display here.

            // TODO: If your application contains multiple pages, ensure that you are
            // handling the hardware Back button by registering for the
            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
            // If you are using the NavigationHelper provided by some templates,
            // this event is handled for you.

            // Rui:
            // Use Windows.Storage.ApplicationData.Current.LocalSettings
            // to load value of CityIdTextBox when naviagte to main page,
            // If localSettings doesn't contain "value", the text is set to default: "City Name"

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (localSettings.Values.ContainsKey("value"))
            {
                CityIdTextBox.Text = localSettings.Values["value"].ToString();
            }

            else
            {
                CityIdTextBox.Text = "City Name";
            }
        }
示例#21
0
        private void LoadConfig()
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (localSettings.Values["AlwaysShowNavigation"] != null)
            {
                App.AlwaysShowNavigation = (bool)localSettings.Values["AlwaysShowNavigation"];
            }
            else
            {
                App.AlwaysShowNavigation = true;
            }

            if (localSettings.Values["BlogCountOneTime"] != null)
            {
                App.BlogCountOneTime = int.Parse(localSettings.Values["BlogCountOneTime"].ToString());
            }
            else
            {
                App.BlogCountOneTime = 20;
            }

            if (localSettings.Values["Theme"] != null)
            {
                App.Theme = (ApplicationTheme)Enum.Parse(typeof(ApplicationTheme), localSettings.Values["Theme"].ToString());
            }
            else
            {
                App.Theme = ApplicationTheme.Light;
            }
        }
示例#22
0
        public HashSet <string> LoadFiredEvents()
        {
#if TEST_WINPHONE || WINDOWS_PHONE
            HashSet <string>          firedEvents = new HashSet <string>();
            Dictionary <string, bool> contents;

            storageMutex.WaitOne();
            try
            {
                if (IsolatedStorageSettings.ApplicationSettings.TryGetValue <Dictionary <string, bool> >(FIRED_EVENTS_KEY, out contents))
                {
                    firedEvents.dict = contents;
                }
            }
            finally
            {
                storageMutex.ReleaseMutex();
            }
            return(firedEvents);
#else
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            if (!localSettings.Values.ContainsKey(FIRED_EVENTS_KEY))
            {
                return(new HashSet <string>());
            }
            return(new HashSet <string>((string[])localSettings.Values[FIRED_EVENTS_KEY]));
#endif
        }
示例#23
0
        public string LoadUuid()
        {
#if TEST_WINPHONE || WINDOWS_PHONE
            string guid = null;

            storageMutex.WaitOne();
            try
            {
                if (IsolatedStorageSettings.ApplicationSettings.TryGetValue <string>(UUID_KEY, out guid))
                {
                    return(guid);
                }
                guid = Guid.NewGuid().ToString();
                IsolatedStorageSettings.ApplicationSettings[UUID_KEY] = guid;
                IsolatedStorageSettings.ApplicationSettings.Save();
            }
            finally
            {
                storageMutex.ReleaseMutex();
            }
            return(guid);
#else
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            if (localSettings.Values.ContainsKey(UUID_KEY))
            {
                return((string)localSettings.Values[UUID_KEY]);
            }
            string guid = Guid.NewGuid().ToString();
            localSettings.Values[UUID_KEY] = guid;
            return(guid);
#endif
        }
        private void load_state(TextBlock tv, Image img, string nametest)
        {
            Windows.Storage.ApplicationDataContainer roamingSettings =
                Windows.Storage.ApplicationData.Current.RoamingSettings;

            String temp;

            if (roamingSettings.Values.ContainsKey(nametest))
            {
                temp = roamingSettings.Values[nametest].ToString();
                roamingSettings.Values[nametest] = null;
                if (temp == "тест пройден")
                {
                    load_icon(img, 0);
                }
                else
                {
                    load_icon(img, 1);
                }

                tv.Text += " " + temp;
            }
            else
            {
                temp = "тест не пройден";
                load_icon(img, 1);

                tv.Text += " " + temp;
            }
        }
示例#25
0
        public AppSettings()
        {
            if (Instance == null)
            {
                Instance = this;
            }

            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();

            ConnectionStateText = new[]
            {
                loader.GetString("NotConnected"), loader.GetString("Connecting"), loader.GetString("Connected"),
                loader.GetString("CouldNotConnect"), loader.GetString("Disconnecting")
            };
            DeviceNames = new List <string>
            {
                loader.GetString("Bluetooth"),
                loader.GetString("NetworkDiscovery"),
                loader.GetString("NetworkDirect")
            };

            try
            {
                localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

                connectionList = new Connections();
            }
            catch (Exception e)
            {
                Debug.WriteLine("Exception while using LocalSettings: " + e.ToString());
                throw;
            }
        }
示例#26
0
        public SpeedMode()
        {
            this.InitializeComponent();
            breakRecord   = false;
            localsettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (localsettings.Values["highestScore_speed"] == null)
            {
                highestScore_speed = 0;
                localsettings.Values["highestScore_speed"] = highestScore_speed;
            }
            highestScore_speed = int.Parse(localsettings.Values["highestScore_speed"].ToString());
            localsettings.Values["oldScore"] = highestScore_speed;
            history.Text = "Best:" + highestScore_speed.ToString();

            if (localsettings.Values["hardness"] == null)
            {
                hardness = 5;
                localsettings.Values["hardness"] = hardness;
            }
            hardness = int.Parse(localsettings.Values["hardness"].ToString());

            currentScore           = 0;
            this.score.DataContext = currentScore;
            shulff();
            leftTime = hardness;
            leftLife = 1;
            startTimer();
            startTimerToPlayMusic();
        }
示例#27
0
        public MainPage()
        {
            this.InitializeComponent();

            //don't let the app go idle
            _displayRequest = new Windows.System.Display.DisplayRequest();
            _displayRequest.RequestActive();

            //===================================
            //Get values from config

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            Windows.Storage.StorageFolder            localFolder   = Windows.Storage.ApplicationData.Current.LocalFolder;

            //Some sample config getters from my other project.  A reminder to myself...
            //enableWingsCheckbox.IsChecked = GetConfig_Bool(localSettings, "EnableWings");
            //enableHeadCheckbox.IsChecked = GetConfig_Bool(localSettings, "EnableHead");
            //enableLeftEyeCheckbox.IsChecked = GetConfig_Bool(localSettings, "EnableLeftEye");
            //enableRightEyeCheckbox.IsChecked = GetConfig_Bool(localSettings, "EnableRightEye");

            _slider = new CamSliderCommander.Isaac879SliderControl();

            _slider.DeviceError   += _component_DeviceError;
            _slider.MoveCompleted += _component_MoveCompleted;

            _slider.DeviceInfoMessage += _slider_DeviceInfoMessage;

            _slider.Initialize();
        }
示例#28
0
        public static SharePointCredentialInformation GetSharePointCredentials()
        {
            SharePointCredentialInformation credentialInformation = null;

            Windows.Storage.ApplicationDataCompositeValue composite = null;

            try
            {
                Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                composite = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["SharePointCredentials"];

                if (composite != null)
                {
                    credentialInformation = new SharePointCredentialInformation()
                    {
                        RootSiteUrl = (string)composite["RootSiteUrl"],
                        UserName    = (string)composite["UserName"],
                        Password    = (string)composite["Password"],
                    };
                }
            }
            catch (Exception ex)
            {
            }

            return(credentialInformation);
        }
示例#29
0
        public ReportIssuePage()
        {
            this.InitializeComponent();
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            var view = ApplicationView.GetForCurrentView();

            view.Title       = "Report an issue/问题反馈";
            txtDetails.Text += "General:\n";
            txtDetails.Text += string.Format("OS version: build {0}\n", SystemInformation.OperatingSystemVersion.Build);
            txtDetails.Text += string.Format("App version: {0}.{1}.{2} {3}\n",
                                             Package.Current.Id.Version.Major,
                                             Package.Current.Id.Version.Minor,
                                             Package.Current.Id.Version.Build,
                                             Package.Current.Id.Architecture);
            txtDetails.Text += string.Format("Package ID: {0}\n\n", Package.Current.Id.Name);
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            if (localSettings.Values["isCrashed"] != null &&
                (bool)localSettings.Values["isCrashed"] == true &&
                localSettings.Values["exception"] != null)
            {
                localSettings.Values.Remove("isCrashed");
                var lastExeption = (string)localSettings.Values["exception"];
                txtDetails.Text += "Exception:\n";
                txtDetails.Text += lastExeption;
            }
        }
示例#30
0
 public static void WritePasswordData()
 {
     Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     localSettings.Values["passwordStatus"] = passwordStatus;
     localSettings.Values["winHelloStatus"] = winHelloStatus;
     localSettings.Values["password"]       = password;
 }
 private void SetAppStore(string _ipString, string _portString)
 {
     Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     Windows.Storage.StorageFolder            localFolder   = Windows.Storage.ApplicationData.Current.LocalFolder;
     localSettings.Values["serverPort"] = _portString;
     localSettings.Values["ipAddress"]  = _ipString;
 }
示例#32
0
        // initialise should be run after constructor, in try block (catch NoListingsAvailableException)
        public UserInfo()
        {
            roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;

            // THIS NEEDS TO BE IMPLEMENTED!
            postCode = "0";
        }
示例#33
0
        public AppSettingModel()
        {
            valueCommon = Windows.Storage.ApplicationData.Current.LocalSettings;

            _isDark = ThemeSetting == "Dark" ? true : false;
            //if (ThemeSetting == "Dark")
            //{
            //    //IconColor = "#0fed88";
            //    //TextblockExtraThreadColor = "#a2a3aa";
            //    //TextblockCreateUserColor = "#bcccb7";
            //    //TextblockMessageColor = "White";
            //    //TextblockQuoteColor = "#afdbb6";
            //    //BackgroundTimeColor = "#9aacb8";
            //    //BackgroundPanelUserColor = "#1a1917";
            //    //TextblockTimePostColor = "White";
            //    //BackgroundThread = "#262628";
            //    _isDark = true;
            //}
            //else
            //{
            //    //IconColor = "#1414d5";
            //    //TextblockExtraThreadColor = "9aacb8";
            //    //TextblockCreateUserColor = "#9aacb8";
            //    //TextblockMessageColor = "Black";
            //    //TextblockQuoteColor = "#afdbb6";
            //    //BackgroundTimeColor = "#5C7099";
            //    //BackgroundPanelUserColor = "#E1E4F2";
            //    //TextblockTimePostColor = "White";
            //    //BackgroundThread = "White";
            //    _isDark = false;
            //}
        }
示例#34
0
 private Windows.Storage.ApplicationDataContainer FrameStateContainer()
 {
     if (_frameStateContainer != null)
         return _frameStateContainer;
     var data = Windows.Storage.ApplicationData.Current;
     var key = GetFrameStateKey();
     _frameStateContainer = data.LocalSettings.CreateContainer(key, Windows.Storage.ApplicationDataCreateDisposition.Always);
     return _frameStateContainer;
 }
        public SettingsUserControl()
        {
            InitializeComponent();

            _applicationData = Windows.Storage.ApplicationData.Current;
            _roamingSettings = _applicationData.RoamingSettings;

            _applicationData.DataChanged += _applicationData_DataChanged;
        }
示例#36
0
        public Capture()
        {
            this.InitializeComponent();
            DataContext = this;
            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
           
            InitializeMediaCaptureAsync();

        }
示例#37
0
 public AuthClient() 
 {
     roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
     var sessionSignature = (string)roamingSettings.Values["sessionSignature"];
     var sessionCookie = (string)roamingSettings.Values["sessionCookie"];
     if (!string.IsNullOrEmpty(sessionSignature) && !string.IsNullOrEmpty(sessionCookie))
     {
         AvoSignature = sessionSignature;
         CookieValue = sessionCookie;
     }
 }
        public MainPage()
        {
            this.InitializeComponent();
            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

            if (localSettings.Values["NightScoutURL"] != null)
                NightScoutURL = localSettings.Values["NightScoutURL"].ToString();
            
            this.NavigationCacheMode = NavigationCacheMode.Required;               

        }
示例#39
0
        public HomePage()
        {
            this.InitializeComponent();

            this.currentViewModel = new ViewModels.HomePageViewModel();

            this.DataContext = this.currentViewModel;
            this.roamingSetting = Windows.Storage.ApplicationData.Current.RoamingSettings;

            if (!isPrivacySet)
            {
                isPrivacySet = true;
                SettingsPane.GetForCurrentView().CommandsRequested += ShowPrivacyPolicy;
            }
        }
 public LangChooseDialog(string part)
 {
     this.InitializeComponent();
     if(part == "settings") {
         rm = Windows.Storage.ApplicationData.Current.RoamingSettings;
         Deser();
     }
     else {
         settingName += "\\" + part;
     }
     this.SizeChanged += (s,e) => {
         scl.Height = e.NewSize.Height - 125;
     };
     lsvw.ItemsSource = ls;
 }
示例#41
0
        private ModuleLoader()
        {
            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            if (localSettings.Values["LoadedModules"] == null)
            {

                Debug.WriteLine("LoadedModule Settings null");
                loadedModules = new List<String>();
                //Used to generate defaults loaded modules
                //localSettings.Values["LoadedModules"] = new string[] { "ModuleTest", "ModuleTest2" };

            }
            else
                loadedModules = new List<String>(localSettings.Values["LoadedModules"] as string[]);
        }
        public SettingsPage()
        {
            this.InitializeComponent();

            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            app = App.Current as SensorTagReader.App ;

            ServiceBusNamespaceField.Text = app.ServiceBusNamespace;
            EventHubNameField.Text = app.EventHubName;
            SharedAccessPolicyNameField.Text = app.SharedAccessPolicyName;
            SharedAccessPolicyKeyField.Text = app.SharedAccessPolicyKey;
            SensorNameField.Text = app.SensorName;

            // getVersionNumberOfApp();
        }
示例#43
0
        public Login()
        {
            this.InitializeComponent();
            this.localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            // check if data is stored and if so put it in the form
            // TODO autoforward
            if (localSettings.Values.ContainsKey("apikey") && localSettings.Values.ContainsKey("vCode"))
            {
                this.apiKey = localSettings.Values["apikey"].ToString();
                this.ApiKey.Text = localSettings.Values["apikey"].ToString();

                this.vCode = localSettings.Values["vCode"].ToString();
                this.VerificationCode.Text = localSettings.Values["vCode"].ToString();

                this.StoreData.IsChecked = true;
            }
        }
        public TestSetupPageModel()
        {
            _localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            Items = new ObservableCollection<TestItemWrapper>();
            _model = new TestSetupModel();
            var rate =_localSettings.Values[nameof(CorrectnessRate)];
            if (rate is int)
            {
                _model.CorrectnessRate = (int)rate;
            }

            AddInitialTestItem();

            Tests = new ObservableCollection<string>();
            RefreshTestList(DefaulTestName);
            _showTestDeleteButton = false;
            _canExecute = true;
            PopupCloseEnabled = true;
        }
示例#45
0
        public MainPage()
        {
            this.InitializeComponent();
            StatusField.Text = "Please ensure the sensor is connected";

            tagreader = new TagReaderService();

            eventHubWriterTimer = new DispatcherTimer();
            eventHubWriterTimer.Interval = new TimeSpan(0, 0, 1);
            eventHubWriterTimer.Tick += OnEventHubWriterTimerTick;

            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if(ServiceBusNamespaceField.Text == string.Empty)    ServiceBusNamespaceField.Text = Convert.ToString(localSettings.Values["ServiceBusNamespaceField"]);
            if(EventHubNameField.Text == string.Empty)           EventHubNameField.Text = Convert.ToString(localSettings.Values["EventHubNameField"]);
            if(SharedAccessPolicyNameField.Text == string.Empty) SharedAccessPolicyNameField.Text = Convert.ToString(localSettings.Values["SharedAccessPolicyNameField"]);
            if(SharedAccessPolicyKeyField.Text == string.Empty)  SharedAccessPolicyKeyField.Text = Convert.ToString(localSettings.Values["SharedAccessPolicyKeyField"]);
            if(SensorNameField.Text == string.Empty)             SensorNameField.Text = Convert.ToString(localSettings.Values["SensorNameField"]);

            getVersionNumberOfApp();

        }
示例#46
0
        public MainPage()
        {
            this.InitializeComponent();
            todoText = new List<string>();
            localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            Object autoAddDate = localSettings.Values["autoAddDate"];
            if (autoAddDate != null)
            {
                if (autoAddDate is bool && (bool)autoAddDate == true)
                {
                    autoDateCB.IsChecked = true;
                }
                else
                {
                    autoDateCB.IsChecked = false;
                }
            }
            else
            {
                autoDateCB.IsChecked = true;
                localSettings.Values["autoAddDate"] = true;
            }

            Object autoArchive = localSettings.Values["autoArchive"];
            if (autoArchive != null)
            {
                if (autoArchive is bool && (bool)autoArchive == true)
                {
                    autoArchiveCB.IsChecked = true;
                }
                else
                {
                    autoArchiveCB.IsChecked = false;
                }
            }
            else
            {
                autoArchiveCB.IsChecked = true;
                localSettings.Values["autoArchive"] = true;
            }

            Object loadedTodoFileToken = localSettings.Values["todoFileToken"];
            if (loadedTodoFileToken != null)
            {
                if (loadedTodoFileToken.GetType() == todoFileToken.GetType())
                {
                    todoFileToken = (string)loadedTodoFileToken;
                    loadFileFromToken("todo");
                }
            }

            Object loadedDoneFileToken = localSettings.Values["doneFileToken"];
            if (loadedDoneFileToken != null)
            {
                if (loadedDoneFileToken.GetType() == doneFileToken.GetType())
                {
                    doneFileToken = (string)loadedDoneFileToken;
                    loadFileFromToken("done");
                }
            }

        }
示例#47
0
 public SettingsPage()
 {
     this.InitializeComponent();
     localSettings= Windows.Storage.ApplicationData.Current.LocalSettings;
 }
 internal ApplicationDataContainer(Windows.Storage.ApplicationDataContainer container)
 {
     _container = container;
 }