public LoadGistWindow(PasteCodeAsGistAddin addin)
        {
            Addin = addin;

            InitializeComponent();

            mmApp.SetThemeWindowOverride(this);

            Model = new LoadAndSaveGistModel(addin)
            {
                Configuration = PasteCodeAsGistConfiguration.Current,
                GistUsername  = PasteCodeAsGistConfiguration.Current.GithubUsername
            };
            Model.PropertyChanged += (o, args) =>
            {
                if (args.PropertyName == "GistUsername")
                {
                    Task t = Model.LoadGists(this);
                }
            };
            DataContext = Model;

            Loaded += LoadGistWindow_Loaded;

            Status = new StatusBarHelper(StatusText, StatusIcon);
        }
Example #2
0
        public async Task LogInAsync(string username, string password)
        {
            // Display progress indicator.
            await StatusBarHelper.ShowStatusBarAsync(App.Strings.GetString("StatusLoggingInMessage"));

            // Try to log in with the given credentials.
            var response = await App.Snapchat.AuthenticateAsync(username, password);

            if (response.IsLogInSuccessful)
            {
                // TODO: Navigate to MainPage with the account passed as a reference.
                await new MessageDialog("Yay, you logged in! Username: "******"LogInGenericErrorMessage")
                                        : response.Message;

                // TODO: Record error info to be sent to our error tracker

                await new MessageDialog(message).ShowAsync();
            }

            // Hide progress indicator.
            await StatusBarHelper.HideStatusBarAsync();
        }
        public ExtendedSplash(SplashScreen splashscreen, bool loadState)
        {
            InitializeComponent();

            AppTheme = DataShareManager.Current.AppTheme;

            if (InformationHelper.IsMobile)
            {
                //StatusBarHelper.ShowStatusBar(AppTheme == ElementTheme.Dark);
            }
            else
            {
                StatusBarHelper.ShowStatusBar(AppTheme == ElementTheme.Dark);
            }

            // Listen for window resize events to reposition the extended splash screen image accordingly.
            // This ensures that the extended splash screen formats properly in response to window resizing.
            Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);

            splash = splashscreen;
            if (splash != null)
            {
                // Register an event handler to be executed when the splash screen has been dismissed.
                splash.Dismissed += new TypedEventHandler <SplashScreen, Object>(DismissedEventHandler);

                // Retrieve the window coordinates of the splash screen image.
                splashImageRect = splash.ImageLocation;

                ScaleFactor = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;

                PositionElement();
            }

            PrepareSDK();
        }
Example #4
0
 protected virtual void SetUpStatusBar()
 {
     if (ApiInformationHelper.HasStatusBar())
     {
         StatusBarHelper.SetUpBlueStatusBar();
     }
 }
Example #5
0
#pragma warning restore

        private void CreateFrame()
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame              = new Frame();
                rootFrame.Background   = App.Current.Resources["MyerSplashDarkColor"] as SolidColorBrush;
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                rootFrame.Navigate(typeof(MainPage), null);
            }
            Window.Current.Activate();

            TitleBarHelper.SetUpLightTitleBar();
            if (DeviceHelper.IsMobile)
            {
                StatusBarHelper.SetUpStatusBar();
            }

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
            SystemNavigationManager.GetForCurrentView().BackRequested -= App_BackRequested;
            SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
            if (APIInfoHelper.HasHardwareButton)
            {
                HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
                HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }
        }
Example #6
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }

            // Set TitleBar and StatusBar colors
            Color backgroundColor         = (Color)Current.Resources["SystemAccentColor"];
            Color lightBackgroundColor    = (Color)Current.Resources["LightAccentColor"];
            Color darkBackgroundColor     = (Color)Current.Resources["DarkAccentColor"];
            Color foregroundColor         = Colors.White;
            Color inactiveForegroundColor = new Color()
            {
                A = 255, R = 60, G = 60, B = 60
            };
            StatusBarHelper.CustomizeTitleBar(backgroundColor, foregroundColor, backgroundColor, inactiveForegroundColor,
                                              backgroundColor, foregroundColor, darkBackgroundColor, foregroundColor, lightBackgroundColor, foregroundColor, backgroundColor, inactiveForegroundColor);
            StatusBarHelper.CustomizeStatusBar(backgroundColor, foregroundColor);

            // Set Background color for root frame
            rootFrame.Background = (SolidColorBrush)Current.Resources["BackgroundBrush"];

            // BackRequested
            NavigationService.RegisterBackRequestedEvent();

            // Ensure the current window is active
            Window.Current.Activate();
        }
        public MasterDetailPageViewModel()
        {
            AppTheme = DataShareManager.Current.AppTheme;
            User     = DataShareManager.Current.User;

            StatusBarHelper.ShowStatusBar(AppTheme == ElementTheme.Dark);
            DataShareManager.Current.DataChanged += Current_DataChanged;
        }
 /// <summary>
 /// 切换日夜间模式
 /// </summary>
 public void DayNightMode()
 {
     if (AppTheme == ElementTheme.Dark)
     {
         DataShareManager.Current.UpdateAppTheme(ElementTheme.Light);
         StatusBarHelper.ShowStatusBar(false);
     }
     else
     {
         DataShareManager.Current.UpdateAppTheme(ElementTheme.Dark);
         StatusBarHelper.ShowStatusBar(true);
     }
 }
Example #9
0
        private async void Import()
        {
            using (var handle = Insights.TrackTime("Import Music"))
            {
                UiBlockerUtility.Block("Scanning...");
                var localMusic = await LocalMusicHelper.GetFilesInMusicAsync();

                handle.Data.Add("TotalCount", localMusic.Count.ToString());
                var failedCount = 0;

                App.Locator.CollectionService.Songs.SuppressEvents   = true;
                App.Locator.CollectionService.Artists.SuppressEvents = true;
                App.Locator.CollectionService.Albums.SuppressEvents  = true;

                App.Locator.SqlService.BeginTransaction();
                for (var i = 0; i < localMusic.Count; i++)
                {
                    StatusBarHelper.ShowStatus(
                        string.Format("Importing {0} of {1} items", i + 1, localMusic.Count),
                        (double)i / localMusic.Count);
                    try
                    {
                        await LocalMusicHelper.SaveTrackAsync(localMusic[i]);
                    }
                    catch
                    {
                        failedCount++;
                    }
                }

                App.Locator.SqlService.Commit();

                App.Locator.CollectionService.Songs.Reset();
                App.Locator.CollectionService.Artists.Reset();
                App.Locator.CollectionService.Albums.Reset();

                UiBlockerUtility.Unblock();

                if (failedCount > 0)
                {
                    CurtainPrompt.ShowError("Couldn't import {0} song(s).", failedCount);
                    handle.Data.Add("Failed", failedCount.ToString());
                }
            }

            await CollectionHelper.DownloadAlbumsArtworkAsync();

            await CollectionHelper.DownloadArtistsArtworkAsync();
        }
Example #10
0
        public ConfigurationEditorWindow()
        {
            InitializeComponent();

            Model              = new ConfigurationEditorModel();
            DataContext        = Model;
            Model.EditorWindow = this;
            mmApp.SetThemeWindowOverride(this);

            StatusBar = new StatusBarHelper(StatusText, StatusIcon);

            Loaded += ConfigurationEditorWindow_Loaded;

            Model.PropertyChanged += Model_PropertyChanged;
        }
Example #11
0
        private async Task LaunchTheApp()
        {
            Dispatcher             = Window.Current.Dispatcher;
            Window.Current.Content = new MainPage();
            await SplitShell.TemplateApplied.Task;

#if WINDOWS_PHONE_APP
            StatusBarHelper.Initialize();
#else
            AppViewHelper.SetAppView();
#endif
            Locator.MainVM.DropTablesIfNeeded();
            ApplicationFrame.Navigated += this.RootFrame_FirstNavigated;
            Window.Current.Activate();
        }
        public ScreenCaptureForm()
        {
            InitializeComponent();

            mmApp.SetThemeWindowOverride(this);

            StatusBar = new StatusBarHelper(this.StatusText, StatusIcon);

            Loaded      += ScreenCaptureForm_Loaded;
            Unloaded    += ScreenCaptureForm_Unloaded;
            SizeChanged += ScreenCaptureForm_SizeChanged;
            KeyDown     += ScreenCaptureForm_KeyDown;

            DataContext = this;
        }
Example #13
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (DeviceHelper.IsMobile)
            {
                StatusBarHelper.SetUpStatusBar();
            }
            Frame.BackStack.Clear();

            _titleBarUc = new EmptyTitleControl();
            (this.Content as Grid).Children.Add(_titleBarUc);
            Grid.SetColumnSpan(_titleBarUc, 5);
            Grid.SetRowSpan(_titleBarUc, 5);
        }
Example #14
0
        private async void DownloadScheme()
        {
            var scheme = PagedSchemesView.CurrentItem as Scheme;

            if (scheme != null)
            {
                var file = await StudioStylesService.DownloadAsync(scheme.DownloadPath);

                if (SettingsActivator.LoadScheme(file))
                {
                    SchemesHistory.Add(scheme);

                    StatusBarHelper.Update(string.Format("The Style '{0}' was activated successfully!", scheme.Title));
                }
            }
        }
Example #15
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            // Insert code here to initialize your application

            //Select Main.storyboard storyboard
            Storyboard = NSStoryboard.FromName("Main", null);

            //Find the corresponding viewcontroller through the Storyboard ID and convert it to the ViewController.
            Controller = Storyboard.InstantiateControllerWithIdentifier("PopoverView") as ViewController;

            //Putthe ViewController in the popup
            Popover.ContentViewController = Controller;

            //popup initialized in StatusBar and add icon
            StatusBar = new StatusBarHelper(Popover, "StatusBarIcon.png");
        }
        public WeblogForm(WeblogAddinModel model)
        {
            Model = model;
            model.ActivePostMetadata = new WeblogPostMetadata();

            model.ActiveWeblogInfo = new WeblogInfo();

            model.Window = this;

            InitializeComponent();

            mmApp.SetThemeWindowOverride(this);

            Loaded  += WebLogStart_Loaded;
            Closing += WebLogStart_Closing;

            StatusBar = new StatusBarHelper(StatusText, StatusIcon);
        }
Example #17
0
#pragma warning disable 1998
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            if (e.PrelaunchActivated)
            {
                return;
            }

            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame              = new Frame();
                rootFrame.Background   = App.Current.Resources["MyerSplashDarkColor"] as SolidColorBrush;
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            Window.Current.Activate();

            TitleBarHelper.SetUpLightTitleBar();
            if (DeviceHelper.IsMobile)
            {
                StatusBarHelper.SetUpStatusBar();
            }

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
            SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
            if (APIInfoHelper.HasHardwareButton)
            {
                HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }
        }
Example #18
0
        public async void Loaded(object param)
        {
            if (App.HasSyncedListOnce)
            {
                return;
            }

            if (param is LoginMode)
            {
                App.HasSyncedListOnce = true;

                await HandleActive((LoginMode)param);
            }

            if (APIInfoUtil.HasStatusBar)
            {
                StatusBarHelper.SetUpStatusBar();
            }

            this.CurrentMainPage = (Window.Current.Content as Frame).Content as Page;
        }
 public virtual void OnShow()
 {
     OnShownChanged?.Invoke(this, new ShownArgs()
     {
         Shown = true
     });
     _titleBarControl = TitleBarHelper.CustomTitleBar(this.Content);
     _titleBarControl.OnClickBackBtn += (x, e) =>
     {
         Shown = false;
     };
     //Window.Current.SetTitleBar(this);
     if (DeviceHelper.IsMobile)
     {
         StatusBarHelper.SetUpBlackStatusBar();
     }
     else
     {
         TitleBarHelper.SetUpTitleBarColorForDarkText();
     }
 }
        public WeblogForm(WeblogAddinModel model)
        {
            Model = model;
            model.ActivePostMetadata = new WeblogPostMetadata();

            model.ActiveWeblogInfo = new WeblogInfo();

            model.Window = this;

            InitializeComponent();

            mmApp.SetThemeWindowOverride(this);
            if (mmApp.Configuration.ApplicationTheme == Themes.Light)
            {
                TabControl.Background = (SolidColorBrush)Resources["LightThemeTitleBackground"];
            }

            Loaded  += WebLogStart_Loaded;
            Closing += WebLogStart_Closing;

            StatusBar = new StatusBarHelper(StatusText, StatusIcon);
        }
        public ImportDotnetLibraryDialog()
        {
            InitializeComponent();
            mmApp.SetThemeWindowOverride(this);

            Model = new ImportDotnetLibraryModel()
            {
                AppModel    = mmApp.Model,
                AddinModel  = kavaUi.AddinModel,
                ParentTopic = kavaUi.AddinModel.ActiveTopic
            };

            Model.AssemblyPath =
                @"C:\projects2010\Westwind.Utilities\Westwind.Utilities\bin\Release\net46\Westwind.Utilities.dll";

            DataContext = Model;

            TopicPicker.SelectTopic(Model.AddinModel.ActiveTopic);

            TopicPicker.TopicSelected = TopicSelected;

            StatusBar = new StatusBarHelper(StatusText, StatusIcon);
        }
Example #22
0
 private void OnTranslucentStatusRequest(StatusBarHelper helper, bool makeTranslucent)
 {
     MakeStatusBarTranslucent(makeTranslucent);
 }
Example #23
0
        public async override void NavigatedTo(Windows.UI.Xaml.Navigation.NavigationMode mode, object parameter)
        {
            base.NavigatedTo(mode, parameter);

            var reset = App.Locator.AppSettingsHelper.Read <bool>("FactoryReset");

            var startingMsg = "Restoring (this may take a bit)...";

            if (reset)
            {
                startingMsg = "Factory resetting...";
            }

            using (Insights.TrackTime(reset ? "Factory Reset" : "Restore Collection"))
            {
                StatusBarHelper.ShowStatus(startingMsg);

                var file = reset ? null : await StorageHelper.GetFileAsync("_current_restore.autcp");

                //delete artowkr and mp3s
                var artworkFolder = await StorageHelper.GetFolderAsync("artworks");

                var artistFolder = await StorageHelper.GetFolderAsync("artists");

                var songFolder = await StorageHelper.GetFolderAsync("songs");

                if (artworkFolder != null)
                {
                    await artworkFolder.DeleteAsync();
                }

                if (artistFolder != null)
                {
                    await artistFolder.DeleteAsync();
                }

                if (songFolder != null)
                {
                    await songFolder.DeleteAsync();
                }

                if (!reset)
                {
                    using (var stream = await file.OpenAsync(FileAccess.ReadAndWrite))
                    {
                        await AutcpFormatHelper.UnpackBackup(ApplicationData.Current.LocalFolder, stream);
                    }

                    await file.DeleteAsync();

                    App.Locator.CollectionService.LibraryLoaded += async(sender, args) =>
                    {
                        await CollectionHelper.DownloadArtistsArtworkAsync(false);

                        await CollectionHelper.DownloadAlbumsArtworkAsync(false);
                    };

                    App.Locator.AppSettingsHelper.Write("Restore", false);
                }
                else
                {
                    var dbs = (await ApplicationData.Current.LocalFolder.GetFilesAsync())
                              .Where(p => p.FileType == ".sqldb").ToList();

                    foreach (var db in dbs)
                    {
                        await db.DeleteAsync();
                    }

                    App.Locator.AppSettingsHelper.Write("FactoryReset", false);
                }

                StatusBarHelper.HideStatus();
            }

            (Application.Current as App).BootAppServicesAsync();
            App.Navigator.GoTo <HomePage, ZoomOutTransition>(null, false);
        }
Example #24
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            CacheUtilInstance = new CacheUtil();
            await CacheUtilInstance.LoadAsync();

            GlobalLocaleHelper.SetupLang(null);

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame            = new Frame();
                rootFrame.Background = App.Current.Resources["MyerSplashDarkColor"] as SolidColorBrush;

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter

                if (!LocalSettingHelper.HasValue("UPDATED_TO_1.1"))
                {
                    var files1 = await CacheUtil.GetCachedFileFolder().GetItemsAsync();

                    foreach (var file in files1)
                    {
                        await file.DeleteAsync(StorageDeleteOption.PermanentDelete);
                    }
                    var files2 = await CacheUtil.GetTempFolder().GetItemsAsync();

                    foreach (var file in files2)
                    {
                        await file.DeleteAsync(StorageDeleteOption.PermanentDelete);
                    }
                    LocalSettingHelper.AddValue("UPDATED_TO_1.1", true);
                }

                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();

            TitleBarHelper.SetUpThemeTitleBar();
            if (DeviceHelper.IsMobile)
            {
                StatusBarHelper.SetUpStatusBar();
            }

            SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
            if (APIInfoHelper.HasHardwareButton)
            {
                HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }
        }