Esempio n. 1
0
        private async void btnLoadAppInfo_Click_1(object sender, RoutedEventArgs e)
        {
            ZumoTestGlobals.ResetInstance();
            SavedAppInfo savedAppInfo = await AppInfoRepository.Instance.GetSavedAppInfo();

            if (savedAppInfo.MobileServices.Count == 0)
            {
                await Util.MessageBox("There are no saved applications.", "Error");
            }
            else
            {
                Popup           popup = new Popup();
                SaveAppsControl page  = new SaveAppsControl(savedAppInfo.MobileServices);
                page.CloseRequested += (snd, ea) =>
                {
                    if (page.ApplicationUrl != null && page.ApplicationKey != null)
                    {
                        this.txtAppUrl.Text = page.ApplicationUrl;
                        this.txtAppKey.Text = page.ApplicationKey;
                    }

                    popup.IsOpen = false;
                };

                popup.Child  = page;
                popup.IsOpen = true;
            }
        }
Esempio n. 2
0
        private async void btnSaveAppInfo_Click_1(object sender, RoutedEventArgs e)
        {
            ZumoTestGlobals.ResetInstance();
            SavedAppInfo appInfo = await AppInfoRepository.Instance.GetSavedAppInfo();

            string appUrl = this.txtAppUrl.Text;
            string appKey = this.txtAppKey.Text;

            if (string.IsNullOrEmpty(appUrl) || string.IsNullOrEmpty(appKey))
            {
                await Util.MessageBox("Please enter valid application URL / key", "Error");
            }
            else
            {
                if (appInfo.MobileServices.Any(ms => ms.AppKey == appKey && ms.AppUrl == appUrl))
                {
                    await Util.MessageBox("Mobile service info already saved", "Information");
                }
                else
                {
                    appInfo.MobileServices.Add(new MobileServiceInfo {
                        AppUrl = appUrl, AppKey = appKey
                    });
                    await AppInfoRepository.Instance.SaveAppInfo(appInfo);

                    await Util.MessageBox("Mobile service info successfully saved", "Information");
                }
            }
        }