コード例 #1
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            DispatcherHelper.Initialize();

            var applicationWindow = new ApplicationView();

            applicationWindow.Show();
        }
コード例 #2
0
 protected override void OnStartup(StartupEventArgs e)
 {
     base.OnStartup(e);
     var app = new ApplicationView();
     var context = new ApplicationViewModel();
     app.DataContext = context;
     app.Show();
 }
コード例 #3
0
        public void AssociateViewWithType(ApplicationView view, Type viewType)
        {
            if (this.viewAssociations.ContainsKey(view))
            {
                this.viewAssociations.Remove(view);
            }

            this.viewAssociations.Add(view, viewType);
        }
コード例 #4
0
        /// <summary>
        /// Navigate to the view, passing the specified parameter.
        /// <summary>
        /// <param name="view">ApplicationView value to navigate to</param>
        /// <param name="parameter">Parameter to pass to the view.</param>
        /// <returns>True if navigation is not canceled; otherwise, false.</returns>
        public bool Navigate(ApplicationView view, object parameter = null)
        {
            //Type viewTypeToNavigate = this.viewAssociations[view];
            if (this.currentView != null)
            {
                this.currentView.OnNavigatedFrom(null);
            }

            IView viewToNavigate = this.GetViewInstance(view);
            this.frame.Content = viewToNavigate;
            this.currentView = viewToNavigate;
            this.currentView.OnNavigatedTo(parameter);

            return true;
        }
コード例 #5
0
        private IView GetViewInstance(ApplicationView applicationView)
        {
            if (this.cachedViews.ContainsKey(applicationView))
            {
                return this.cachedViews[applicationView];
            }

            Type typeToInstantiate = this.viewAssociations[applicationView];
            IView viewToNavigate = Activator.CreateInstance(typeToInstantiate) as IView;
            if (viewToNavigate == null)
            {
                throw new InvalidOperationException("View to navigate to should be IView");
            }

            this.cachedViews.Add(applicationView, viewToNavigate);
            return viewToNavigate;
        }
コード例 #6
0
        public ActionResult EditApplication(ApplicationView applicationView)
        {
            var anyApplication = Repository.Applications.Where(p=>p.ID!=applicationView.ID).Any(p => string.Compare(p.Name, applicationView.Name) == 0);
            if (anyApplication)
            {
                ModelState.AddModelError("Name", "Приложение с таким наименованием уже существует");
            }
            if (ModelState.IsValid)
            {
                var application = Repository.Applications.FirstOrDefault(p => p.ID == applicationView.ID);
                ModelMapper.Map(applicationView, application, typeof(ApplicationView), typeof(Application));
                Repository.UpdateApplication(application);

                return RedirectToAction("Index");
            }

            return View(applicationView);
        }
コード例 #7
0
        public ActionResult CreateApplication(ApplicationView applicationView)
        {
            var anyApplication = Repository.Applications.Any(p => string.Compare(p.Name, applicationView.Name) == 0);
            if (anyApplication)
            {
                ModelState.AddModelError("Name", "Приложение с таким наименованием уже существует");
            }

            if (ModelState.IsValid)
            {

                var application= (Application)ModelMapper.Map(applicationView, typeof(ApplicationView), typeof(Application));
                Repository.CreateApplication(application);
                return RedirectToAction("Index");
            }

            return View(applicationView);
        }
コード例 #8
0
        public MainWindow()
        {
            InitializeComponent();

            _currentView = DefaultApplicationView;
            _conversationManager = null;
            DisplayOptions options = new DisplayOptions();
            _displayOptions = options as IDisplayOptions;
            _displayOptions.TimeDisplayFormatPropertyChanged += OnTimeDisplayFormatPropertyChanged;
            _displayOptions.HideEmptyConversationsPropertyChanged += OnHideEmptyConversationsPropertyChanged;
            _displayOptions.MergeContactsPropertyChanged += OnMergeContactsPropertyChanged;
            _displayOptions.LoadMmsAttachmentsPropertyChanged += OnLoadMmsAttachmentsPropertyChanged;
            _displayOptions.ConversationSortingPropertyChanged += OnConversationSortingPropertyChanged;
            _phoneSelectOptions = options as IPhoneSelectOptions;

            _deviceInfo = null;

            conversationRenderControl.DisplayOptions = _displayOptions;
            conversationRenderControl.findBar.FindModel = new FindDialogModel(this);

            Loaded += OnLoaded;
        }
コード例 #9
0
 private void AppShell_VisibleBoundsChanged(ApplicationView sender, object args)
 {
     if (sender.IsFullScreenMode)
     {
     }
 }
コード例 #10
0
        // Displays a view as a standalone
        // You can use the resulting ViewLifeTileControl to interact with the new window.
        public async Task <ViewLifetimeControl> TryShowAsStandaloneAsync(string windowTitle, Type pageType)
        {
            ViewLifetimeControl viewControl = await CreateViewLifetimeControlAsync(windowTitle, pageType);

            SecondaryViews.Add(viewControl);
            viewControl.StartViewInUse();
            var viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(viewControl.Id, ViewSizePreference.Default, ApplicationView.GetForCurrentView().Id, ViewSizePreference.Default);

            viewControl.StopViewInUse();
            return(viewControl);
        }
コード例 #11
0
        private void SetApplicationView(ApplicationView view)
        {
            menuViewConversation.IsChecked = false;
            menuViewGraph.IsChecked = false;

            switch (view)
            {
                case ApplicationView.ConversationView:
                    menuViewConversation.IsChecked = true;
                    menuEditCopy.Command = CopyConversationTextCommand.CopyConversationText;
                    _mainWindowModel = _conversationWindowModel;
                    break;
                case ApplicationView.GraphView:
                    menuViewGraph.IsChecked = true;
                    menuEditCopy.Command = CopyGraphCommand.CopyGraph;
                    _mainWindowModel = _graphWindowModel;
                    break;
                default:
                    throw new ArgumentException("Invalid conversation view.");
            }

            _currentView = view;
        }
コード例 #12
0
 private void ViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs e)
 {
     StopViewInUse();
 }
コード例 #13
0
 private WindowInformation(CoreApplicationView coreView, ApplicationView view)
 {
     CoreView = coreView;
     View     = view;
     Manager  = ViewLifetimeManager.CreateForCurrentView();
 }
コード例 #14
0
ファイル: AppViewHelper.cs プロジェクト: yueyz818/vlc-winrt
        public static void EnterFullscreen()
        {
            var v = ApplicationView.GetForCurrentView();

            v.TryEnterFullScreenMode();
        }
コード例 #15
0
ファイル: AppViewHelper.cs プロジェクト: yueyz818/vlc-winrt
        public static async Task SetAppView(bool extend)
        {
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                await StatusBar.GetForCurrentView().HideAsync();
            }

            if (DeviceHelper.GetDeviceType() == DeviceTypeEnum.Xbox)
            {
                ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
            }

            if (DeviceHelper.GetDeviceType() == DeviceTypeEnum.Phone)
            {
                ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
            }

            if (DeviceHelper.GetDeviceType() != DeviceTypeEnum.Tablet)
            {
                return;
            }
            if (Numbers.OSVersion <= 10586)
            {
                return;
            }

            var coreAppViewTitleBar = CoreApplication.GetCurrentView().TitleBar;
            var titleBar            = ApplicationView.GetForCurrentView().TitleBar;


            if (!Locator.SettingsVM.MediaCenterMode)
            {
                coreAppViewTitleBar.ExtendViewIntoTitleBar = extend;
                if (extend)
                {
                    titleBar.BackgroundColor         = Colors.Transparent;
                    titleBar.InactiveBackgroundColor = Colors.Transparent;

                    titleBar.ButtonBackgroundColor         = Colors.Transparent;
                    titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

                    titleBar.ButtonForegroundColor         = Colors.White;
                    titleBar.ButtonInactiveForegroundColor = Colors.White;
                }
                else
                {
                    titleBar.BackgroundColor         = Colors.DimGray;
                    titleBar.InactiveBackgroundColor = Colors.DimGray;

                    titleBar.InactiveBackgroundColor = Colors.DarkGray;

                    titleBar.ButtonBackgroundColor         = Colors.DimGray;
                    titleBar.ButtonInactiveBackgroundColor = Colors.DarkGray;

                    titleBar.ButtonForegroundColor         = Colors.White;
                    titleBar.ButtonInactiveForegroundColor = Colors.White;
                }
            }
            else
            {
                coreAppViewTitleBar.ExtendViewIntoTitleBar = false;
            }
        }
コード例 #16
0
 public MainPage()
 {
     this.InitializeComponent();
     AV = ApplicationView.GetForCurrentView();
     AV.TryResizeView(new Size(x, y));
 }
コード例 #17
0
 public static bool IsCompactOverlaySupported(this ApplicationView view)
 {
     return(ApiInformation.IsMethodPresent("Windows.UI.ViewManagement.ApplicationView", "IsViewModeSupported") && view.IsViewModeSupported(ApplicationViewMode.CompactOverlay));
 }
コード例 #18
0
 private void CurrentView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     // Clean up code to shut down secondary windows as this one closes
     Application.Current.Exit();
 }
コード例 #19
0
 private void MainPage_VisibleBoundsChanged(ApplicationView sender, object args)
 {
     // Update Fullscreen from other modes of adjusting view (keyboard shortcuts)
     IsFullScreen = ApplicationView.GetForCurrentView().IsFullScreenMode;
     //ApplyUiColors();
 }
コード例 #20
0
        private async void Dispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs e)
        {
            if (!xpoWebView.IsWebAppLoaded)
            {
                return;
            }

            if (e.EventType == CoreAcceleratorKeyEventType.KeyDown || e.EventType == CoreAcceleratorKeyEventType.SystemKeyDown)
            {
                // We won't process the event if the currently focused element is WebView,
                // as the web app can handle keyboard shortcuts itself.
                if (FocusManager.GetFocusedElement().GetType() == typeof(WebView))
                {
                    return;
                }

                var shiftState   = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Shift);
                var shiftPressed = (shiftState & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;

                var ctrlState   = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Control);
                var ctrlPressed = (ctrlState & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;

                var altState   = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Menu);
                var altPressed = (altState & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;

                logger.Info(e.VirtualKey);
                var isHandled = await KeyboardShortcutHelper.KeyDown(e.VirtualKey, shiftPressed, ctrlPressed, altPressed, xpoWebView.Controller, nowPlaying);

                if (isHandled == KeyboardShortcutHelper.KeyDownProcessResult.AskJs)
                {
                    logger.Info("Sending it to js...");
                    int charCode    = (int)e.VirtualKey;
                    var handledByJs = await xpoWebView.Controller.OnKeyDown(charCode, shiftPressed, ctrlPressed, altPressed);

                    if (handledByJs)
                    {
                        if (nowPlaying.IsOpen)
                        {
                            if (nowPlaying.ViewMode == NowPlayingView.NowPlayingViewMode.CompactOverlay)
                            {
                                CloseCompactOverlay();
                            }
                            else
                            {
                                CloseNowPlaying();
                            }
                        }
                    }
                }
                else if (isHandled == KeyboardShortcutHelper.KeyDownProcessResult.GoBack)
                {
                    if (nowPlaying.IsOpen)
                    {
                        if (nowPlaying.ViewMode == NowPlayingView.NowPlayingViewMode.CompactOverlay)
                        {
                            CloseCompactOverlay();
                        }
                        else if (ApplicationView.GetForCurrentView().IsFullScreenMode)
                        {
                            nowPlaying.ToggleFullscreen();
                        }
                        else
                        {
                            CloseNowPlaying();
                        }
                    }
                }
            }
        }
コード例 #21
0
 public Contactos()
 {
     ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(200, 150));
     this.InitializeComponent();
 }
コード例 #22
0
        public static async Task <List <int> > OpenFilesAndCreateNewTabsFiles(int IDList, StorageListTypes type)
        {
            var list_ids = new List <int>();

            switch (type)
            {
            case StorageListTypes.LocalStorage:
                var opener = new FileOpenPicker();
                opener.ViewMode = PickerViewMode.Thumbnail;
                opener.SuggestedStartLocation = PickerLocationId.ComputerFolder;
                opener.FileTypeFilter.Add("*");

                IReadOnlyList <StorageFile> files = await opener.PickMultipleFilesAsync();

                foreach (StorageFile file in files)
                {
                    await Task.Run(() =>
                    {
                        if (file != null)
                        {
                            StorageApplicationPermissions.FutureAccessList.Add(file);
                            BasicProperties properties = Task.Run(async() => { return(await file.GetBasicPropertiesAsync()); }).Result;

                            var tab = new InfosTab {
                                TabName = file.Name, TabStorageMode = type, TabContentType = ContentType.File, CanBeDeleted = true, CanBeModified = true, TabOriginalPathContent = file.Path, TabInvisibleByDefault = false, TabType = LanguagesHelper.GetLanguageType(file.Name), TabDateModified = properties.DateModified.ToString()
                            };

                            int id_tab = Task.Run(async() => { return(await TabsWriteManager.CreateTabAsync(tab, IDList, false)); }).Result;
                            if (Task.Run(async() => { return(await new StorageRouter(TabsAccessManager.GetTabViaID(new TabID {
                                    ID_Tab = id_tab, ID_TabsList = IDList
                                }), IDList).ReadFile(true)); }).Result)
                            {
                                Messenger.Default.Send(new STSNotification {
                                    Type = TypeUpdateTab.NewTab, ID = new TabID {
                                        ID_Tab = id_tab, ID_TabsList = IDList
                                    }
                                });
                            }

                            list_ids.Add(id_tab);
                        }
                    });
                }
                break;

            case StorageListTypes.OneDrive:
                var currentAV = ApplicationView.GetForCurrentView(); var newAV = CoreApplication.CreateNewView();

                await newAV.Dispatcher.RunAsync(
                    CoreDispatcherPriority.Normal,
                    async() =>
                {
                    var newWindow    = Window.Current;
                    var newAppView   = ApplicationView.GetForCurrentView();
                    newAppView.Title = "OneDrive explorer";

                    var frame = new Frame();
                    frame.Navigate(typeof(OnedriveExplorer), new Tuple <OnedriveExplorerMode, TabID>(OnedriveExplorerMode.SelectFile, new TabID {
                        ID_TabsList = IDList
                    }));
                    newWindow.Content = frame;
                    newWindow.Activate();

                    await ApplicationViewSwitcher.TryShowAsStandaloneAsync(
                        newAppView.Id,
                        ViewSizePreference.UseHalf,
                        currentAV.Id,
                        ViewSizePreference.UseHalf);
                });

                break;
            }

            return(list_ids);
        }
コード例 #23
0
ファイル: App.xaml.cs プロジェクト: Alvaromah/eShopOnUWP
 private void SetPreferredMinSize()
 {
     ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(500, 500));
 }
コード例 #24
0
ファイル: App.xaml.cs プロジェクト: hacysean/BreadPlayer
        void LoadFrame(IActivatedEventArgs args, object arguments)
        {
            try
            {
                var stop = Stopwatch.StartNew();
                BLogger.Logger.Info("Loading frame started...");
                Frame rootFrame = Window.Current.Content as Frame;

                // Do not repeat app initialization when the Window already has content
                if (rootFrame == null)
                {
                    // Create a Frame to act as the navigation context
                    rootFrame = new Frame();
                    BLogger.Logger.Info("New frame created.");
                    if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    {
                        //CoreWindowLogic.ShowMessage("HellO!!!!!", "we are here");
                        //TODO: Load state from previously suspended application
                    }
                    rootFrame.NavigationFailed += OnNavigationFailed;
                    // Place the frame in the current Window
                    Window.Current.Content = rootFrame;
                    BLogger.Logger.Info("Content set to Window successfully...");
                }
                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
                    BLogger.Logger.Info("Navigating to Shell...");
                    rootFrame.Navigate(typeof(Shell), arguments);
                }

                // CoreWindowLogic logic = new CoreWindowLogic();
                var view = ApplicationView.GetForCurrentView();
                view.SetPreferredMinSize(new Size(360, 100));
                if (RequestedTheme == ApplicationTheme.Dark)
                {
                    view.TitleBar.BackgroundColor       = Color.FromArgb(20, 20, 20, 1);
                    view.TitleBar.ButtonBackgroundColor = Color.FromArgb(20, 20, 20, 1);
                }
                if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    //view.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                    var statusBar = StatusBar.GetForCurrentView();
                    statusBar.BackgroundColor   = RequestedTheme == ApplicationTheme.Light ? (App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color : Color.FromArgb(20, 20, 20, 1);
                    statusBar.BackgroundOpacity = 1;
                    statusBar.ForegroundColor   = Colors.White;
                }
                if (args.Kind != ActivationKind.File)
                {
                    CoreWindowLogic.LoadSettings();
                }
                else
                {
                    CoreWindowLogic.LoadSettings(true);
                }
                Window.Current.Activate();
                stop.Stop();
                Debug.Write(stop.ElapsedMilliseconds.ToString() + "\r\n");
            }
            catch (Exception ex)
            {
                BLogger.Logger?.Info("Exception occured in LoadFrame Method", ex);
            }
        }
コード例 #25
0
        /// <summary>
        /// Call this method in Unity App Thread can switch to Plan View, create and show a new XAML View. 
        /// </summary>
        /// <typeparam name="TReturnValue"></typeparam>
        /// <param name="xamlPageName"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public IEnumerator OnLaunchXamlView<TReturnValue>(string xamlPageName, Action<TReturnValue> callback, object pageNavigateParameter = null)
        {
            bool isCompleted = false;
#if !UNITY_EDITOR && UNITY_WSA
            object returnValue = null;
            CoreApplicationView newView = CoreApplication.CreateNewView();
            int newViewId = 0;
            var dispt = newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                //This happens when User switch view back to Main App manually 
                void CoreWindow_VisibilityChanged(CoreWindow sender, VisibilityChangedEventArgs args)
                {
                    if (args.Visible == false)
                    {
                        CallbackReturnValue(null);
                    }
                }
                newView.CoreWindow.VisibilityChanged += CoreWindow_VisibilityChanged;
                Frame frame = new Frame();
                var pageType = Type.GetType(Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName.Replace(".App,", $".{xamlPageName},"));
                var appv = ApplicationView.GetForCurrentView();
                newViewId = appv.Id;
                var cb = new Action<object>(rval =>
                {
                    returnValue = rval;
                    isCompleted = true;
                });
                frame.Navigate(pageType,pageNavigateParameter);
                CallbackDictionary[newViewId] = cb;
                Window.Current.Content = frame;
                Window.Current.Activate();

            }).AsTask();
            yield return new WaitUntil(() => dispt.IsCompleted || dispt.IsCanceled || dispt.IsFaulted);
            Task viewShownTask = null;
            UnityEngine.WSA.Application.InvokeOnUIThread(
                () =>
                {
                    viewShownTask = ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId).AsTask();
                },
                    true);
            yield return new WaitUntil(() => viewShownTask.IsCompleted || viewShownTask.IsCanceled || viewShownTask.IsFaulted);
            yield return new WaitUntil(() => isCompleted);
            try
            {
                if (returnValue is TReturnValue)
                {
                    callback?.Invoke((TReturnValue)returnValue);
                }
                else
                {
                    callback?.Invoke(default(TReturnValue));
                }
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
            }
#else
            isCompleted = true;
            yield return new WaitUntil(() => isCompleted);
#endif
        }
コード例 #26
0
ファイル: ZhiHuPivot.cs プロジェクト: hanyn/ZhiHu
        public static Size ScreenSize()
        {
            var bounds = ApplicationView.GetForCurrentView().VisibleBounds;

            return(new Size(bounds.Width, bounds.Height));
        }
コード例 #27
0
ファイル: AppViewHelper.cs プロジェクト: yueyz818/vlc-winrt
        public static void LeaveFullscreen()
        {
            var v = ApplicationView.GetForCurrentView();

            v.ExitFullScreenMode();
        }
コード例 #28
0
 public void RemoveGap()
 {
     //FullScreenMode
     ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
 }
コード例 #29
0
ファイル: AppViewHelper.cs プロジェクト: yueyz818/vlc-winrt
 public static bool GetFullscreen()
 {
     return(ApplicationView.GetForCurrentView().IsFullScreenMode);
 }
コード例 #30
0
        private async void NavigationFrame_Navigating(object sender, NavigatingCancelEventArgs navigationEventArgs)
        {
            ProcessSampleEditorTime();

            SampleCategory category;

            if (navigationEventArgs.SourcePageType == typeof(SamplePicker) || navigationEventArgs.Parameter == null)
            {
                DataContext    = null;
                _currentSample = null;
                category       = navigationEventArgs.Parameter as SampleCategory;

                if (category != null)
                {
                    TrackingManager.TrackPage($"{navigationEventArgs.SourcePageType.Name} - {category.Name}");
                }
                else
                {
                    TrackingManager.TrackPage($"{navigationEventArgs.SourcePageType.Name}");
                }

                HideInfoArea();
            }
            else
            {
                TrackingManager.TrackPage(navigationEventArgs.SourcePageType.Name);
                Commands.Clear();
                ShowInfoArea();

                var sampleName = navigationEventArgs.Parameter.ToString();
                _currentSample = await Samples.GetSampleByName(sampleName);

                DataContext = _currentSample;

                if (_currentSample == null)
                {
                    HideInfoArea();
                    return;
                }

                category = await Samples.GetCategoryBySample(_currentSample);

                await Samples.PushRecentSample(_currentSample);

                var propertyDesc = _currentSample.PropertyDescriptor;

                InfoAreaPivot.Items.Clear();

                if (propertyDesc != null)
                {
                    _xamlRenderer.DataContext = propertyDesc.Expando;
                }

                Title.Text = _currentSample.Name;

                if (propertyDesc != null && propertyDesc.Options.Count > 0)
                {
                    InfoAreaPivot.Items.Add(PropertiesPivotItem);
                }

                if (_currentSample.HasXAMLCode)
                {
                    if (AnalyticsInfo.VersionInfo.GetDeviceFormFactor() != DeviceFormFactor.Desktop)
                    {
                        // Only makes sense (and works) for now to show Live Xaml on Desktop, so fallback to old system here otherwise.
                        XamlReadOnlyCodeRenderer.XamlSource = _currentSample.UpdatedXamlCode;

                        InfoAreaPivot.Items.Add(XamlReadOnlyPivotItem);
                    }
                    else
                    {
                        XamlCodeRenderer.Text = _currentSample.UpdatedXamlCode;

                        InfoAreaPivot.Items.Add(XamlPivotItem);

                        _xamlCodeRendererSupported = true;
                    }

                    InfoAreaPivot.SelectedIndex = 0;
                }

                if (_currentSample.HasCSharpCode)
                {
                    CSharpCodeRenderer.CSharpSource = await this._currentSample.GetCSharpSourceAsync();

                    InfoAreaPivot.Items.Add(CSharpPivotItem);
                }

                if (_currentSample.HasJavaScriptCode)
                {
                    JavaScriptCodeRenderer.CSharpSource = await this._currentSample.GetJavaScriptSourceAsync();

                    InfoAreaPivot.Items.Add(JavaScriptPivotItem);
                }

                if (!string.IsNullOrEmpty(_currentSample.CodeUrl))
                {
                    GitHub.NavigateUri = new Uri(_currentSample.CodeUrl);
                    GitHub.Visibility  = Visibility.Visible;
                }
                else
                {
                    GitHub.Visibility = Visibility.Collapsed;
                }

                if (_currentSample.HasDocumentation)
                {
                    var docs = await this._currentSample.GetDocumentationAsync();

                    if (!string.IsNullOrWhiteSpace(docs))
                    {
                        DocumentationTextblock.Text = docs;
                        InfoAreaPivot.Items.Add(DocumentationPivotItem);
                    }
                }

                if (InfoAreaPivot.Items.Count == 0)
                {
                    HideInfoArea();
                }

                TitleTextBlock.Text = $"{category.Name} -> {_currentSample?.Name}";
                ApplicationView.SetTitle(this, $"{category.Name} - {_currentSample?.Name}");
            }

            await SetHamburgerMenuSelection();
        }
コード例 #31
0
 private void UnregisterForEvents()
 {
     ApplicationView.GetForCurrentView().Consolidated -= ViewConsolidated;
 }
コード例 #32
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 = false;
            }
#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

                // Load profile URL and go to Games page
                var profileUrl = (string)ApplicationData.Current.RoamingSettings.Values["ProfileUrl"];
                if (!string.IsNullOrEmpty(profileUrl))
                {
                    rootFrame.Navigate(typeof(GamesPage), profileUrl);
                }
                else
                {
                    // Start without Steam ID?
                    var loadWithout = ApplicationData.Current.RoamingSettings.Values["StartWithoutSteamId"] as bool?;
                    if (loadWithout.HasValue && loadWithout.Value)
                    {
                        rootFrame.Navigate(typeof(GamesPage), null);
                    }
                    else
                    {
                        // First time
                        rootFrame.Navigate(typeof(MainPage), e.Arguments);
                    }
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();

            // Tile
            SetupPeriodicTileUpdate();

            // Full screen on phones
            if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile")
            {
                var view = ApplicationView.GetForCurrentView();
                if (!view.IsFullScreenMode)
                {
                    view.TryEnterFullScreenMode();
                }
            }
        }
コード例 #33
0
ファイル: Menu.xaml.cs プロジェクト: oLucasRez/lp2-noelf-rpg
 private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     ApplicationView.GetForCurrentView().TryResizeView(new Size(860, 640));
 }
コード例 #34
0
 public TizenApplicationViewExtension(object owner, TizenWindow window)
 {
     _owner       = (ApplicationView)owner;
     _ownerEvents = (IApplicationViewEvents)owner;
     _window      = window;
 }
コード例 #35
0
    void Awake()
    {
        applicationView = this;

        // Determines the screensize we will need to scale the UI elements.
        orthographicScreenHeight = Camera.main.orthographicSize * 2;
        orthographicScreenWidth = orthographicScreenHeight * Screen.width / Screen.height;
    }
コード例 #36
0
ファイル: App.xaml.cs プロジェクト: CookieWookie/ais
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            ApplicationViewModel viewModel = App.appVM = new ApplicationViewModel();
            ApplicationView view = new ApplicationView
            {
                DataContext = viewModel
            };

            view.ShowDialog();
        }
コード例 #37
0
ファイル: MainPage.xaml.cs プロジェクト: Ozhiganov/UwpWebApps
 private void ApplicationView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     webView.NavigateToString("about:blank");
 }
コード例 #38
0
ファイル: MainPage.xaml.cs プロジェクト: Ozhiganov/UwpWebApps
        private void ChangeTitle(string title)
        {
            var currentView = ApplicationView.GetForCurrentView();

            currentView.Title = title;
        }
コード例 #39
0
 public ActionResult CreateApplication()
 {
     var newapplicationsView = new ApplicationView();
     return View(newapplicationsView);
 }
コード例 #40
0
        public MainPage(IServiceProvider provider
                        , ILogger <MainPage> logger
                        , DocumentViewModel <StorageFile, IRandomAccessStream> viewModel
                        , QuickPadCommands <StorageFile, IRandomAccessStream> command
                        , IVisualThemeSelector vts)
        {
            Provider   = provider;
            VtSelector = vts;
            Logger     = logger;
            Commands   = command;

            Clipboard.ContentChanged += Clipboard_ContentChanged;

            GotFocus += OnGotFocus;

            Initialize?.Invoke(this, Commands, App);

            this.InitializeComponent();

            var rtfOptions = provider.GetService <RtfDocumentOptions>();

            rtfOptions.Document  = RichEditBox.Document;
            rtfOptions.Logger    = provider.GetService <ILogger <RtfDocument> >();
            rtfOptions.ViewModel = viewModel;

            var textOptions = provider.GetService <TextDocumentOptions>();

            textOptions.Document  = TextBox;
            textOptions.Logger    = provider.GetService <ILogger <TextDocument> >();
            textOptions.ViewModel = viewModel;

            CreateNewDocument?.Invoke(this);

            DataContext = ViewModel = viewModel;

            Loaded   += OnLoaded;
            Unloaded += OnUnloaded;

            //extent app in to the title bar
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            var tBar = ApplicationView.GetForCurrentView().TitleBar;

            tBar.ButtonBackgroundColor         = Colors.Transparent;
            tBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            Settings.ExitApplication = ExitApp;

            ViewModel.PropertyChanged += ViewModel_PropertyChanged;

            Settings.PropertyChanged += Settings_PropertyChanged;

            ViewModel.SetScale += ViewModel_SetScale;

            SystemNavigationManagerPreview.GetForCurrentView().CloseRequested += this.OnCloseRequest;

            var currentView = SystemNavigationManager.GetForCurrentView();

            currentView.BackRequested += CurrentView_BackRequested;

            if (SystemInformation.Instance.TotalLaunchCount == 3)
            {
                var(success, dialog) = provider.GetService <DialogManager>().RequestDialog <AskForReviewDialog>();

                if (!success)
                {
                    return;
                }

                _ = dialog.ShowAsync();
            }

            _initialized = true;
        }
コード例 #41
0
 public QualificationListPage()
 {
     this.InitializeComponent();
     Loaded += QualificationListPage_Loaded;
     ApplicationView.GetForCurrentView().Title = "Qualifications";
 }
コード例 #42
0
 private void AppView_VisibleBoundsChanged(
     ApplicationView sender,
     object args)
 {
     this.UpdateRootFrameBounds();
 }