private void clkGravaDados(object sender, RoutedEventArgs e)
        {
            Windows.Storage.ApplicationDataCompositeValue DadosCompostos = 
                new Windows.Storage.ApplicationDataCompositeValue();

            DadosCompostos["MeuInteiro"] = 1;
            DadosCompostos["MinhaString"] = "Hello World";

            DadosLocal.Values["DefinicaoDadosCompostos"] = DadosCompostos;
            lblResultado.Text = "Dados Locais Foram Gravados";
        }
        public void StoreInRoaming(string key, Dictionary<object, object> values)
        {
            Windows.Storage.StorageFolder roamingFolder = Windows.Storage.ApplicationData.Current.RoamingFolder;

            Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue();

            foreach (KeyValuePair<object, object> pair in values)
                composite[pair.Key.ToString()] = pair.Value;

            //if (roamingSettings.Values.ContainsKey(key))
            _roamingSettings.Values[key] = composite;
        }
        /// <summary>
        /// 保存登录信息
        /// </summary>
        private void SaveLoginInfo()
        {
            string un = UserName.Text;
            string pwd = PassWord.Password;

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            Windows.Storage.ApplicationDataCompositeValue composite =
           (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["LoginInfos"];
            if (composite == null)
            {
                composite = new Windows.Storage.ApplicationDataCompositeValue();
            }
            composite[un] = pwd;
            localSettings.Values["LoginInfos"] = composite;
        }
Exemple #4
0
        public bool readSocketListenerDatafromLocalStorage(StationLib.StationSocketListener listener, Windows.Storage.ApplicationDataCompositeValue composite, int ListenerIdx)
        {
            if (m_localStorage == null)
            {
                return(false);
            }
            m_localStorage.SetSourceIDName("StationSocketListener", ListenerIdx);


            int  Idx      = -1;
            bool bStoreOk = m_localStorage.readSettingsfromLocalStorage(composite, Idx);

            if (bStoreOk)
            {
                string StringValue;
                int    IntValue;
                double dblValue;
                bool   boolValue;

                bool bok = m_localStorage.readStringSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.HostName", Idx), out StringValue);
                listener.HostName = StringValue;

                bok           = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.Port", Idx), out IntValue);
                listener.Port = IntValue;

                bok = m_localStorage.readStringSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.ViewName", Idx), out StringValue);
                listener.ViewName = StringValue;

                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.SensorViewSelection", Idx), out IntValue);
                listener.SensorViewSelection = IntValue;


                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.ChartViewSelection", Idx), out IntValue);
                listener.ChartViewSelection = IntValue;

                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.BME280SensorId", Idx), out IntValue);
                listener.BME280SensorId = IntValue;

                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.GPIOHCSR04EchoPin", Idx), out IntValue);
                listener.GPIOHCSR04EchoPin = IntValue;

                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.GPIOHCSR04TriggPin", Idx), out IntValue);
                listener.GPIOHCSR04TriggPin = IntValue;

                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLedPin", Idx), out IntValue);
                listener.OutPutLedPin = IntValue;

                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLevel1Pin", Idx), out IntValue);
                listener.OutPutLevel1Pin = IntValue;

                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLevel2Pin", Idx), out IntValue);

                listener.OutPutLevel2Pin = IntValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.RefreshRateinSec", Idx), out dblValue);

                listener.RefreshRateinSec = dblValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.MaxLevelMillimeterProSec", Idx), out dblValue);

                listener.MaxLevelMillimeterProSec = dblValue;

                bok = m_localStorage.readBoolSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.eMailWellFillingLevelMinActiv", Idx), out boolValue);

                listener.eMailWellFillingLevelMinActiv = boolValue;

                bok = m_localStorage.readBoolSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.eMailWellFillingLevelMaxActiv", Idx), out boolValue);

                listener.eMailWellFillingLevelMaxActiv = boolValue;

                bok = m_localStorage.readBoolSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.eMailFillingLevelMinActiv", Idx), out boolValue);

                listener.eMailFillingLevelMinActiv = boolValue;

                bok = m_localStorage.readBoolSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutWellFillingLevelMinActiv", Idx), out boolValue);

                listener.OutPutWellFillingLevelMinActiv = boolValue;

                bok = m_localStorage.readBoolSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutFillingLevelMinActiv", Idx), out boolValue);

                listener.OutPutFillingLevelMinActiv = boolValue;


                bok = m_localStorage.readBoolSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.ListenerMode", Idx), out boolValue);

                listener.ListenerMode = boolValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLevel1PinActivValue", Idx), out dblValue);

                listener.OutPutLevel1PinActivValue = dblValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLevel2PinActivValue", Idx), out dblValue);

                listener.OutPutLevel2PinActivValue = dblValue;


                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.ShutDownPin", Idx), out IntValue);
                listener.ShutDownPin = IntValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.InletFillLevelInPercent", Idx), out dblValue);
                listener.InletFillLevelInPercent = dblValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.InletMaxActiveTime", Idx), out dblValue);
                listener.InletMaxActiveTime = dblValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.InletCycleFlushingTime", Idx), out dblValue);
                listener.InletCycleFlushingTime = dblValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.InletMaxCycleFlushingActiveTime", Idx), out dblValue);
                listener.InletMaxCycleFlushingActiveTime = dblValue;



                StationSensors sensorValue = listener.StationSensors;
                int            SensorsIdx  = 0;

                m_localStorage.ResetCompositeName();
                m_localStorage.DataCompositeIDName = m_localStorage.getCompositePropertyIDName("StationSensorValues", -1);
                bool bfound = readSensorDatafromLocalStorage(sensorValue, composite, SensorsIdx);


/*
 *              int SensorsIdx = 0;
 *              while (true) // vorhandene Profiles aus den Settings lesen
 *              {
 *                  StationLib.StationSensors SensorValues =  new StationSensors();
 *                  listener.StationSensors.AddSensorValues(SensorValues);
 *                  m_localStorage.ResetCompositeName();
 *                  m_localStorage.DataCompositeIDName = m_localStorage.getCompositePropertyIDName("StationSensorValues", -1);
 *
 *                  bool bfound = readSensorDatafromLocalStorage(SensorValues, composite, SensorsIdx);
 *                  if (!bfound)
 *                  {// wiede loeschen, wenn nicht gefunden
 *                      listener.BME280SensorsValues.deleteSensorValues(SensorValues);
 *                      break;
 *                  }
 *
 *
 *                  SensorsIdx++;
 *              }
 */
            }

            return(bStoreOk);
        }
Exemple #5
0
        public bool writeSocketListenerDatatoLocalStorage(StationLib.StationSocketListener listener, Windows.Storage.ApplicationDataCompositeValue composite, int ListenerIdx)
        {
            if (m_localStorage == null)
            {
                return(false);
            }
            m_localStorage.SetSourceIDName("StationSocketListener", ListenerIdx);

            int Idx = -1;

            bool bok = m_localStorage.writeSettingsToLocalStorage(composite, Idx);

            bok = m_localStorage.writeStringSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.HostName", Idx), listener.HostName);
            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.Port", Idx), listener.Port);
            bok = m_localStorage.writeStringSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.ViewName", Idx), listener.ViewName);


            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.SensorViewSelection", Idx), listener.SensorViewSelection);



            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.ChartViewSelection", Idx), listener.ChartViewSelection);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.BME280SensorId", Idx), listener.BME280SensorId);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.GPIOHCSR04EchoPin", Idx), listener.GPIOHCSR04EchoPin);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.GPIOHCSR04TriggPin", Idx), listener.GPIOHCSR04TriggPin);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLedPin", Idx), listener.OutPutLedPin);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLevel1Pin", Idx), listener.OutPutLevel1Pin);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLevel2Pin", Idx), listener.OutPutLevel2Pin);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.RefreshRateinSec", Idx), listener.RefreshRateinSec);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.MaxLevelMillimeterProSec", Idx), listener.MaxLevelMillimeterProSec);

            bok = m_localStorage.writeBoolSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.eMailWellFillingLevelMinActiv", Idx), listener.eMailWellFillingLevelMinActiv);

            bok = m_localStorage.writeBoolSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.eMailWellFillingLevelMaxActiv", Idx), listener.eMailWellFillingLevelMaxActiv);

            bok = m_localStorage.writeBoolSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.eMailFillingLevelMinActiv", Idx), listener.eMailFillingLevelMinActiv);

            bok = m_localStorage.writeBoolSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutWellFillingLevelMinActiv", Idx), listener.OutPutWellFillingLevelMinActiv);


            bok = m_localStorage.writeBoolSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutFillingLevelMinActiv", Idx), listener.OutPutFillingLevelMinActiv);

            bok = m_localStorage.writeBoolSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.ListenerMode", Idx), listener.ListenerMode);


            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLevel1PinActivValue", Idx), listener.OutPutLevel1PinActivValue);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.OutPutLevel2PinActivValue", Idx), listener.OutPutLevel2PinActivValue);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.ShutDownPin", Idx), listener.ShutDownPin);


            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.InletFillLevelInPercent", Idx), listener.InletFillLevelInPercent);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.InletMaxActiveTime", Idx), listener.InletMaxActiveTime);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.InletCycleFlushingTime", Idx), listener.InletCycleFlushingTime);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("listener.InletMaxCycleFlushingActiveTime", Idx), listener.InletMaxCycleFlushingActiveTime);


            StationSensors sensorValue = listener.StationSensors;

            m_localStorage.ResetCompositeName();
            m_localStorage.DataCompositeIDName = m_localStorage.getCompositePropertyIDName("StationSensorValues", -1);


            int SensorsIdx = 0;

            bok = writeSensorDatatoLocalStorage(sensorValue, composite, SensorsIdx);



            return(bok);
        }
Exemple #6
0
        //var authCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);

        public void findAccount_Click(object sender, RoutedEventArgs e)
        {   //verify handle matches regex
            if (!(validHandle.IsMatch(handleInput.Text)))
            {
                FlyoutBase.ShowAttachedFlyout((FrameworkElement)findAccount);
            }
            else
            {
                try
                { //verify handle exists
                    var    webHandler = new HttpClientHandler();
                    var    webClient  = new HttpClient(webHandler);
                    String url        = @"http://twitter.com/" + handleInput.Text;
                    var    pageExist  = webClient.GetAsync(new Uri(url));
                    HttpResponseMessage handleCheck = pageExist.Result;
                    int statusCode = (int)handleCheck.StatusCode;

                    if (statusCode.ToString() == "404") //handle doesn't exist
                    {
                        FlyoutBase.ShowAttachedFlyout((FrameworkElement)findAccount);
                        return;
                    }
                    else
                    {
                        var panel = new StackPanel();

                        panel.Children.Add(new TextBlock
                        {
                            Text         = "Click the button below to launch your browser to complete the Twitter authentication and receive a PIN number.",
                            TextWrapping = TextWrapping.Wrap,
                        });

                        Button launchTwitter = new Button();
                        launchTwitter.Content = "Launch Twitter";
                        launchTwitter.Click  += twitterCheck;
                        panel.Children.Add(launchTwitter);


                        TextBox twtPin = new TextBox();
                        twtPin.Text = "Insert Pin Here";
                        panel.Children.Add(twtPin);

                        ContentDialog dialog = new ContentDialog()
                        {
                            Title = "Twitter Authentication",
                            //RequestedTheme = ElementTheme.Dark,
                            //FullSizeDesired = true,
                            MaxWidth = this.ActualWidth // Required for Mobile!
                        };


                        dialog.Content = panel;


                        dialog.PrimaryButtonText = "Verify Pin";
                        dialog.CloseButtonText   = "Cancel";

                        var result = dialog.ShowAsync();

                        if (result.GetResults() == ContentDialogResult.Primary)
                        {
                            var appCredentials        = new TwitterCredentials(ConsumerKey, ConsumerSecret);
                            var authenticationContext = AuthFlow.InitAuthentication(appCredentials);
                            var userCredentials       =
                                AuthFlow.CreateCredentialsFromVerifierCode(twtPin.Text, authenticationContext);
                            Auth.SetCredentials(userCredentials);
                            Windows.Storage.ApplicationDataCompositeValue composite =
                                new Windows.Storage.ApplicationDataCompositeValue();
                            composite["userKey"]    = userCredentials.ConsumerKey;
                            composite["userSecret"] = userCredentials.ConsumerSecret;

                            if (!(localSettings.Values.ContainsKey("handlesCS")))
                            {
                                localSettings.Values["handlesCS"] = handleInput.Text;
                            }
                            else
                            {
                                localSettings.Values["handlesCS"] = localSettings.Values["handlesCS"].ToString() + "," + handleInput.Text;
                            }
                            localSettings.Values[handleInput.Text] = composite;
                            // the lines above do not seem to be saving the settings. Either that, or I wrote the check to see if the settings are made wrong.
                        }
                    }
                }
                catch
                {
                    // Details in ex.Message and ex.HResult.
                }
            }
        }
Exemple #7
0
        public bool readStationEnvironmentDatafromLocalStorage(StationEnvironment StationEnvironment, Windows.Storage.ApplicationDataCompositeValue composite, int ListenerIdx)
        {
            if (m_localStorage == null)
            {
                return(false);
            }
            m_localStorage.SetSourceIDName("StationEnvironment", ListenerIdx);


            int  Idx      = -1;
            bool bStoreOk = m_localStorage.readSettingsfromLocalStorage(composite, Idx);

            if (bStoreOk)
            {
                string StringValue;

                int IntValue;


                bool bok = m_localStorage.readStringSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.HostName", Idx), out StringValue);
                StationEnvironment.HostName = StringValue;


                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.Port", Idx), out IntValue);
                StationEnvironment.Port = IntValue;
            }
            else
            {
                createDummyConnection();
            }


            return(bStoreOk);
        }
Exemple #8
0
        public bool writeStationEnvironmenttoLocalStorage(StationEnvironment StationEnvironment, Windows.Storage.ApplicationDataCompositeValue composite, int ListenerIdx)
        {
            if (m_localStorage == null)
            {
                return(false);
            }
            m_localStorage.SetSourceIDName("StationEnvironment", ListenerIdx);

            int Idx = -1;

            bool bok = m_localStorage.writeSettingsToLocalStorage(composite, Idx);

            bok = m_localStorage.writeStringSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.HostName", Idx), StationEnvironment.HostName);
            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.Port", Idx), StationEnvironment.Port);

            return(bok);
        }
        private async void MainWebView_ScriptNotify(object sender, NotifyEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Value))
            {
                return;
            }
            var    json   = JsonValue.Parse(e.Value).GetObject();
            string method = json.GetObject().GetNamedString("method");

            switch (method)
            {
            case "restart":
                this.MyWebView.Refresh();
                break;

            case "coming_soon":
                MessageDialog showComingSoonDialog = new MessageDialog("CommonPlace feature coming soon!");
                var           comingSoonResult     = await showComingSoonDialog.ShowAsync();

                break;

            case "no_source":
                MessageDialog showNoSourceDialog = new MessageDialog("Could not run CommonPlace because a source of projects couldn't be found!");
                var           noSourceResult     = await showNoSourceDialog.ShowAsync();

                break;

            case "toggle_fullscreen":
                ToggleFullScreenMode();
                break;

            case "show_email_config":
                Windows.Storage.ApplicationDataContainer      theLocalSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                Windows.Storage.ApplicationDataCompositeValue theComposite     = (Windows.Storage.ApplicationDataCompositeValue)theLocalSettings.Values["smtpSettings"];
                if (theComposite != null)
                {
                    smtp_host.Text         = (String)theComposite["smtpHost"];
                    smtp_username.Text     = (String)theComposite["smtpUsername"];
                    smtp_password.Password = "";      // Password must be re-entered to save again
                    smtp_port.Text         = (String)theComposite["smtpPort"];
                    var smtpSecureBox = (ComboBox)this.smtp_secure;
                    smtpSecureBox.SelectedIndex = ((String)theComposite["smtpSecure"] == "ssl") ? 1 : 0;
                }
                this.emailConfigView.Visibility = Visibility.Visible;
                break;

            case "email":
                string smtpHost, smtpUsername, smtpPassword, smtpSecure, smtpPort;
                smtpHost = smtpUsername = smtpPassword = smtpSecure = smtpPort = String.Empty;
                var ssl_bool = false;
                try
                {
                    Windows.Storage.ApplicationDataContainer      localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                    Windows.Storage.ApplicationDataCompositeValue composite     = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["smtpSettings"];
                    smtpHost     = (String)composite["smtpHost"];
                    smtpUsername = (String)composite["smtpUsername"];
                    smtpPassword = (String)composite["smtpPassword"];
                    smtpPort     = (String)composite["smtpPort"];
                    smtpSecure   = (String)composite["smtpSecure"];
                    ssl_bool     = (smtpSecure.Length > 0) ? true : false;  // "SSL" or none
                }
                catch
                {
                    MessageDialog showCantEmailDialog = new MessageDialog("Unfotunately, email can't be sent at this time because email SMTP settings haven't been setup.");
                    var           cantEmailResult     = await showCantEmailDialog.ShowAsync();

                    return;
                }
                Debug.WriteLine("smtpHost: " + smtpHost + " smtpUsername: "******" smtpPasswrod: " + smtpPassword + " smtpPort: " + smtpPort + " smtpSecure: " + smtpSecure);
                string       address      = json.GetObject().GetNamedString("address");
                string       title        = json.GetObject().GetNamedString("title");
                string       url          = json.GetObject().GetNamedString("url");
                SmtpClient   client       = new SmtpClient(smtpHost, int.Parse(smtpPort), ssl_bool, smtpUsername, smtpPassword);
                EmailMessage emailMessage = new EmailMessage();
                emailMessage.To.Add(new EmailRecipient(address));
                emailMessage.Subject = "[OXY CommonPlace] " + title;
                emailMessage.Body    = title + "\r\n\r\n" + url;
                await client.SendMailAsync(emailMessage);

                break;
            }
        }
        public bool writeGPIOStationEnvironmenttoLocalStorage(GPIOEnvironmentConnector StationEnvironment, Windows.Storage.ApplicationDataCompositeValue composite, int ListenerIdx)
        {
            if (m_localStorage == null)
            {
                return(false);
            }

            m_localStorage.SetSourceIDName("StationEnvironment.GPIO", ListenerIdx);


            int Idx = -1;

            bool bok = m_localStorage.writeSettingsToLocalStorage(composite, Idx);

            bok = m_localStorage.writeStringSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.HostName", Idx), StationEnvironment.HostName);
            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.Port", Idx), StationEnvironment.Port);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.GPIOConnectorEnable", Idx), Convert.ToInt32(StationEnvironment.GPIOConnectorEnable));



            for (int i = 0; i < StationEnvironment.GPIOOInOutBanks.InOutBanks.Count; i++)
            {
                GPIOOBank bank = StationEnvironment.GPIOOInOutBanks.InOutBanks[i];

                foreach (GPIOObjects OutPuts in bank.GPIOBanks)
                {
                    foreach (GPIOObject GPIOObj in OutPuts.GPIOs)
                    {
                        string property = GPIOObj.getPropertyforStorageSettings();
                        bok = m_localStorage.writeStringSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName(GPIOObj.GPIOName, Idx), property) && bok;
                    }
                }
            }



            return(bok);
        }
        public bool writeStationEnvironmenttoLocalStorage(StationEnvironment StationEnvironment, Windows.Storage.ApplicationDataCompositeValue composite, int ListenerIdx)
        {
            if (m_localStorage == null)
            {
                return(false);
            }
            m_localStorage.SetSourceIDName("StationEnvironment", ListenerIdx);

            int Idx = -1;

            bool bok = m_localStorage.writeSettingsToLocalStorage(composite, Idx);


            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.ConnectorSEN0188Enable", Idx), Convert.ToInt32(StationEnvironment.ConnectorSEN0188Enable));

            bok = m_localStorage.writeStringSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.Id", Idx), StationEnvironment.SerDev.Id);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.BaudRate", Idx), StationEnvironment.SerDev.BaudRate);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.WriteTimeout.TotalMilliseconds", Idx), (double)StationEnvironment.SerDev.WriteTimeout.TotalMilliseconds);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.ReadTimeout.TotalMilliseconds", Idx), StationEnvironment.SerDev.ReadTimeout.TotalMilliseconds);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.Parity", Idx), (double)StationEnvironment.SerDev.Parity);

            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.StopBits", Idx), (double)StationEnvironment.SerDev.StopBits);


            bok = m_localStorage.writeDoubleSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.Handshake", Idx), (double)StationEnvironment.SerDev.Handshake);

            bok = m_localStorage.writeIntegerSettingsToLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.EventHistoryinDays", Idx), StationEnvironment.EventHistoryinDays);



            return(bok);
        }
        public bool readGPIOStationEnvironmentDatafromLocalStorage(GPIOEnvironmentConnector StationEnvironment, Windows.Storage.ApplicationDataCompositeValue composite, int ListenerIdx)
        {
            if (m_localStorage == null)
            {
                return(false);
            }
            m_localStorage.SetSourceIDName("StationEnvironment.GPIO", ListenerIdx);


            int  Idx      = -1;
            bool bStoreOk = m_localStorage.readSettingsfromLocalStorage(composite, Idx);

            if (bStoreOk)
            {
                string StringValue;

                int IntValue;

                bool bok = m_localStorage.readStringSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.HostName", Idx), out StringValue);
                if (StringValue.Count() > 0)
                {
                    StationEnvironment.HostName = StringValue;
                }



                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.Port", Idx), out IntValue);
                if (IntValue > 0)
                {
                    StationEnvironment.Port = IntValue;
                }



                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.GPIOConnectorEnable", Idx), out IntValue);
                StationEnvironment.GPIOConnectorEnable = Convert.ToBoolean(IntValue);

                for (int i = 0; i < StationEnvironment.GPIOOInOutBanks.InOutBanks.Count; i++)
                {
                    GPIOOBank bank = StationEnvironment.GPIOOInOutBanks.InOutBanks[i];

                    foreach (GPIOObjects OutPuts in bank.GPIOBanks)
                    {
                        foreach (GPIOObject GPIOObj in OutPuts.GPIOs)
                        {
                            string property;
                            bok = m_localStorage.readStringSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName(GPIOObj.GPIOName, Idx), out property);
                            if (bok)
                            {
                                GPIOObj.CreateGPIOObjectByStorageSettings(property);
                            }
                        }
                    }
                }
            }

            return(bStoreOk);
        }
        public bool readStationEnvironmentDatafromLocalStorage(StationEnvironment StationEnvironment, Windows.Storage.ApplicationDataCompositeValue composite, int ListenerIdx)
        {
            if (m_localStorage == null)
            {
                return(false);
            }
            m_localStorage.SetSourceIDName("StationEnvironment", ListenerIdx);


            int  Idx      = -1;
            bool bStoreOk = m_localStorage.readSettingsfromLocalStorage(composite, Idx);

            if (bStoreOk)
            {
                string StringValue;

                int    IntValue;
                double OutValue;



                bool bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.ConnectorSEN0188Enable", Idx), out IntValue);
                StationEnvironment.ConnectorSEN0188Enable = Convert.ToBoolean(IntValue);

                bok = m_localStorage.readStringSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.Id", Idx), out StringValue);

                if (StringValue.Length == 0)
                {
                    StringValue = "COM1";
                }

                StationEnvironment.SerDev.Id = StringValue;


                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.WriteTimeout.TotalMilliseconds", Idx), out OutValue);

                StationEnvironment.SerDev.WriteTimeout = TimeSpan.FromMilliseconds(OutValue);


                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.ReadTimeout.TotalMilliseconds", Idx), out OutValue);

                StationEnvironment.SerDev.ReadTimeout = TimeSpan.FromMilliseconds(OutValue);

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.Parity", Idx), out OutValue);

                StationEnvironment.SerDev.Parity = (SerialParity)OutValue;
                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.StopBits", Idx), out OutValue);

                StationEnvironment.SerDev.StopBits = (SerialStopBitCount)OutValue;

                bok = m_localStorage.readDoubleSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.SerDev.Handshake", Idx), out OutValue);

                StationEnvironment.SerDev.Handshake = (SerialHandshake)OutValue;

                bok = m_localStorage.readIntegerSettingsfromLocalStorage(composite, m_localStorage.getCompositePropertyIDName("StationEnvironment.EventHistoryinDays", Idx), out IntValue);
                if (IntValue <= 0)
                {
                    IntValue = 4;
                }
                StationEnvironment.EventHistoryinDays = IntValue;
            }



            return(bStoreOk);
        }