コード例 #1
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);
        }
コード例 #2
0
        public bool readDatafromLocalStorage()
        {
            this.Cameras.Clear();
            Windows.Storage.ApplicationDataCompositeValue composite = m_LocalStorageSettings.getCompositeValue();
            int Idx = 0;

            while (true)
            {
                OnVifCamera camera = new OnVifCamera("", "", "");
                bool        bdata  = camera.readSettingsfromLocalStorage(composite, Idx);
                if (bdata)
                {
                    this.Cameras.Add(camera);
                }
                else
                {
                    break;
                }
                Idx++;
            }


            if (this.Cameras.Count == 0) // Add Dummy
            {
                OnVifCamera camera = createDummyCamera();
                this.Cameras.Add(camera);
                this.SelectedIndex = 0;
            }
            else
            {
                Object outvalue;
                bool   bKey = composite.TryGetValue("SelectedIndex", out outvalue);
                if (bKey)
                {
                    this.SelectedIndex = (int)outvalue;
                }
            }


            return(this.Cameras.Count > 0);
        }