Пример #1
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            Helper.DeleteCachedFolder();

            Helper.DeleteCachedFilesFolder();
            SettingsHelper.SaveSettings();
            var deferral = e.SuspendingOperation.GetDeferral();

            //TODO: Save application state and stop any background activity
            try
            {
                if (Helper.InstaApi?.PushClient != null)
                {
                    await Task.Delay(5500);

                    await Helper.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                    {
                        try
                        {
                            await Task.Delay(5500);
                            await Helper.InstaApi.PushClient.TransferPushSocket();
                        }
                        catch { }
                    });
                }
                //if (MultiApiHelper.Pushs.Count > 0)
                //    for (int i = 0; i < MultiApiHelper.Pushs.Count; i++)
                //    {
                //        var push = MultiApiHelper.Pushs[i];
                //        await push.TransferPushSocket();
                //    }
            }
            catch (Exception exception)
            {
                exception.PrintException();
            }
            finally
            {
                deferral.Complete();
            }
        }
Пример #2
0
        public void LoggedOut() // logout is completed?
        {
            var switchToAnotherAccount = false;

            if (InstaApiList.Count > 0)
            {
                InstaApiList.RemoveInstaApi(InstaApi);
                InstaApi = null;
                if (InstaApiList.Count > 0)
                {
                    InstaApi = InstaApiList[0];
                    switchToAnotherAccount = true;
                }
                SessionHelper.DontSaveSettings = true;
            }

            if (!switchToAnotherAccount)
            {
                SetStackPanelTitleVisibility(Visibility.Collapsed);
                NavigationService.Navigate(typeof(Views.Sign.SignInView));
            }
            else
            {
                InstaApiSelectedUsername = InstaApi.GetLoggedUser().UserName.ToLower();
                SettingsHelper.SaveSettings();
                try
                {
                    NavigationService.HideBackButton();
                }
                catch { }
                UserChanged = true;
                try
                {
                    Current.NavigateToMainView(true);
                }
                catch { }
            }
            "You've Been Logged Out.".ShowMsg();
            NavigationService.RemoveAllBackStack();
        }
Пример #3
0
        private void SubmitButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (BottomRadio.IsChecked == true)
                {
                    SettingsHelper.Settings.HeaderPosition     = Classes.HeaderPosition.Bottom;
                    SettingsHelper.Settings.AskedAboutPosition = true;
                    SettingsHelper.SaveSettings();
                }
                else
                {
                    SettingsHelper.Settings.HeaderPosition     = Classes.HeaderPosition.Top;
                    SettingsHelper.Settings.AskedAboutPosition = true;
                    SettingsHelper.SaveSettings();
                }
                ShowHeaders();
            }
            catch { }

            SettingsGrid.Visibility = Visibility.Collapsed;
        }