예제 #1
0
        private async Task InitAsync(bool forceRefresh = false)
        {
            this.DataContext = _vm = new ListeViewModel();
            await _vm.InitBaseAsync();

            IListenService listenService = new ListenService(App.__APIKey);
            var            liste         = await listenService.GetListeAsync(_listentyp, forceRefresh);

            liste = liste.OrderBy(l => l.Name.ToLower()).ToList();
            foreach (var entry in liste)
            {
                _vm.ListenEintraege.Add(entry);
            }

            _vm.DoneLoading();
        }
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            SaveButton.IsEnabled   = false;
            CancelButton.IsEnabled = false;
            var listenService = new ListenService(App.__APIKey);
            var success       = await listenService.SaveListenEintragAsync(_edit);

            if (success.Erfolgreich)
            {
                this.Frame.GoBack();
            }
            else
            {
                Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(success.Fehlermeldung);
                await dialog.ShowAsync();

                return;
            }
            SaveButton.IsEnabled   = true;
            CancelButton.IsEnabled = true;
        }
예제 #3
0
파일: SINetwork.cs 프로젝트: zjbsean/TM
            public bool Listen()
            {
                CloseServerListen();

                try
                {
                    m_serverListen = new ListenService(new ProtocolDealDelegate(onRecvServerData),
                                                       new OpenNewConnectDelegate(onOpenNewServerConnection),
                                                       new ConnectOnCloseDelegate(onServerConnectionClose), false, 0);
                    bool result = m_serverListen.Listion(m_listenPort, 10000);
                    if (result == false)
                    {
                        m_serverListen = null;
                    }
                    return(result);
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }