Example #1
0
        public bool writeListenerDatatoLocalStorage()
        {
            m_LocalStorageSettings.SetSourceIDName("WeatherStationData");

            m_LocalStorageSettings.deleteCompositeValue(); // vor jedem Schreiben alles löschen



            Windows.Storage.ApplicationDataCompositeValue composite = m_LocalStorageSettings.getCompositeValue();

            SocketStationListeners listeners = m_StationEnvironment.StationSocketListeners;


            for (int i = 0; i < listeners.SocketListeners.Count; i++)
            {
                StationSocketListener listener = listeners.SocketListeners[i];
                writeSocketListenerDatatoLocalStorage(listener, composite, i);
            }

            if (composite.ContainsKey("SelectedIndex"))
            {
                composite["SelectedIndex"] = listeners.SelectedIndex;
            }
            else
            {
                composite.Add("SelectedIndex", listeners.SelectedIndex);
            }

            m_LocalStorageSettings.writeCompositeValuetoLocalStorage();

            return(true);
        }
Example #2
0
        public bool readListenerDatafromLocalStorage()
        {
            SocketStationListeners listeners = m_StationEnvironment.StationSocketListeners;


            listeners.clearallListeners();

            m_LocalStorageSettings.SetSourceIDName("WeatherStationData");

            Windows.Storage.ApplicationDataCompositeValue composite = m_LocalStorageSettings.getCompositeValue();
            int Idx = 0;

            while (true)
            {
                StationSocketListener listener = new StationSocketListener();
                listeners.AddListener(listener);


                bool bdata = readSocketListenerDatafromLocalStorage(listener, composite, Idx);
                if (!bdata)
                {
                    // listener wieder aus Queue löshen, wenn nicht benötigt
                    listeners.deleteListener(listener);
                    //    delete listener;
                    break;
                }
                Idx++;
            }


            if (listeners.SocketListeners.Count == 0) // Add Dummy
            {
                StationSocketListener listener = createDummyListener();
                listeners.SocketListeners.Add(listener);
                listeners.SelectedIndex = 0;
            }
            else
            {
                Object outvalue;
                bool   bKey = composite.TryGetValue("SelectedIndex", out outvalue);
                if (bKey)
                {
                    listeners.SelectedIndex = (int)outvalue;
                }
            }


            return(listeners.SocketListeners.Count > 0);
        }