コード例 #1
0
        void CallLoadFunctions(object sender, RoutedEventArgs e)
        {
            if (_initialised)
            {
                return;
            }

            if (!CheckForLogin())
            {
                return;
            }


            var frame = Application.Current.RootVisual as PhoneApplicationFrame;

            frame.Background = Config.Background.GetBrush();

            viewModel.RaiseLoggedInChange();
            viewModel.OnLoad();

            GeolocationPrompt();

            CreateStoryboards();

            ThreadPool.QueueUserWorkItem((threadContext) =>
            {
                CreateTile();
                ShowFollowMessage();
                if (Config.PushEnabled == true || (Config.PushEnabled == null && AskForPushPermission()))
                {
                    PushNotifications.AutoRegisterForNotifications();
                }
                UsernameProvider.FillUserNames(Config.Accounts);
#if DEBUG
                var list = Logger.ReadAll();
                if (list != null)
                {
                    EmailComposeTask email = new EmailComposeTask();
                    email.To        = "*****@*****.**";
                    email.Subject   = "Ocell Error Report";
                    string contents = "";
                    foreach (var line in list)
                    {
                        contents += line + Environment.NewLine;
                    }
                    email.Body = contents;
                    //Dispatcher.BeginInvoke(() => email.Show());
                    Logger.Clear();
                    Logger.Save();
                }
#endif
                LittleWatson.CheckForPreviousException();
            });

            _initialised = true;
        }
コード例 #2
0
        public static IServiceCollection AddSingletonUsernameProvider(this IServiceCollection services, string username)
        {
            var usernameProvider = new UsernameProvider();

            usernameProvider.Set(username);

            services.AddSingleton <IUsernameProvider>(usernameProvider);

            return(services);
        }