示例#1
0
 private async void OnVisibleBoundsChanged(ApplicationView sender, object args)
 {
     if (_lastVisibleBounds == null || _appView.VisibleBounds.Height != _lastVisibleBounds?.Height || _appView.VisibleBounds.Width != _lastVisibleBounds?.Width)
     {
         await UpdateTriggerAsync(_appView.VisibleBounds.Width < _appView.VisibleBounds.Height).ConfigureAwait(false);
     }
     _lastVisibleBounds = _appView.VisibleBounds;
 }
 public MainPage()
 {
     this.InitializeComponent();
     appView = ApplicationView.GetForCurrentView();
     
     appView.TryResizeView(new Size(400, 200));
     
 }
        private void AdaptivePage_VisibleBoundsChanged(ApplicationView sender, object args)
        {
            //Here we are hiding panes when we get to certain thresholds
            if (ApplicationView.GetForCurrentView().VisibleBounds.Width < 768 && ReadingPane != null)
                ReadingPane.Visibility = Visibility.Collapsed;

            if (ApplicationView.GetForCurrentView().VisibleBounds.Width < 1024 && AccountsList != null)
                AccountsList.Visibility = Visibility.Collapsed;
        }
示例#4
0
        /// <summary>
        /// 标题栏特效
        /// </summary>
        private void InitializeFrostedGlass_All()
        {
            Windows.ApplicationModel.Core.CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
            coreTitleBar.ExtendViewIntoTitleBar = true;

            Windows.UI.ViewManagement.ApplicationView view = ApplicationView.GetForCurrentView();
            view.TitleBar.ButtonBackgroundColor         = Colors.Transparent; //将标题栏的三个键背景设为透明
            view.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; //失去焦点时,将三个键背景设为透明
            view.TitleBar.ButtonInactiveForegroundColor = Colors.White;       //失去焦点时,将三个键前景色设为白色

            InitializeFrostedGlass(GlassHost);
        }
示例#5
0
        private async Task AddHandlersAsync()
        {
            //if (_orientationSensor == null) _orientationSensor = SimpleOrientationSensor.GetDefault();
            if (_appView == null) _appView = ApplicationView.GetForCurrentView();
            if (!_isHandlersActive /*&& _orientationSensor != null */ && _appView != null)
            {
                //_orientationSensor.OrientationChanged += OnSensor_OrientationChanged;
                _appView.VisibleBoundsChanged += OnVisibleBoundsChanged;
				await UpdateTriggerAsync(_appView.VisibleBounds.Width < _appView.VisibleBounds.Height).ConfigureAwait(false);
				_isHandlersActive = true;
            }
        }
示例#6
0
        private void OnVisibleBoundsChanged(ApplicationView sender, object args)
        {
            var bounds = ApplicationView.GetForCurrentView().VisibleBounds;
            var h = Window.Current.Bounds.Height;
            var w = Window.Current.Bounds.Width;

            var top = Math.Ceiling((bounds.Top + h) - h);
            var left = Math.Ceiling((bounds.Left + w) - w);
            var right = Math.Ceiling(w - bounds.Right);
            var bottom = Math.Ceiling(h - bounds.Bottom);
            RootFrame.Margin = new Thickness(left, 0, right, bottom);
            /* Shell.HamburgerPadding = new Thickness(left, 0, 0, 0);
            Shell.Padding = new Thickness(left, top, 0, bottom);*/
        }
示例#7
0
        public MainPage()
        {
            var bounds = ApplicationView.GetForCurrentView().VisibleBounds;

            ApplicationView.PreferredLaunchViewSize      = new Size(bounds.Width, bounds.Height);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
            this.InitializeComponent();
            Windows.UI.ViewManagement.ApplicationView appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
            // установка заголовка
            appView.Title = "Хамелеон";
            // получаем ссылку на TitleBar
            Windows.UI.ViewManagement.ApplicationViewTitleBar titleBar = appView.TitleBar;
            // установка цвета панели
            titleBar.BackgroundColor       = Windows.UI.Colors.Black;
            titleBar.ButtonBackgroundColor = Windows.UI.Colors.Black;
            //устанавливает предпочтительные границы для окна приложения
            //appView.SetDesiredBoundsMode();
        }
示例#8
0
    //public static Style MenuFlyoutPresenterStyleBasic
    //{
    //    get
    //    {
    //        var result= new Style()
    //        {
    //            TargetType = typeof(MenuFlyoutPresenter),
    //        };
    //        result.Setters.Add(new Setter(Control.BackgroundProperty,));

    //    }
    //}

    public static async Task OpenRename(Models.FileItems.IFileItem file)
    {
        {
            //Size of ContentDialog has a problem. Not my fault.
            //var dialog = new ContentDialog()
            //{
            //    Content = new Views.RenamePage(),
            //    FullSizeDesired = true,
            //};
            //{
            //    var loader = Application.ResourceLoader.Loader;
            //    dialog.CloseButtonText = loader.GetString("Command/OK");
            //}
            //await dialog.ShowAsync();
        }
        {
            //var newWindow = await Windows.UI.WindowManagement.AppWindow.TryCreateAsync();
            //var newPage = new Views.RenamePage();
            //Windows.UI.Xaml.Hosting.ElementCompositionPreview.SetAppWindowContent(newWindow, newPage);

            //await newWindow.TryShowAsync();
        }
        {
            //https://docs.microsoft.com/ja-jp/windows/apps/design/layout/application-view
            var coreview = Windows.ApplicationModel.Core.CoreApplication.CreateNewView();
            Windows.UI.ViewManagement.ApplicationView newAppView = null;
            await coreview.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                newAppView   = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
                var newFrame = new Frame();
                newFrame.Navigate(typeof(Views.RenamePage), file);
                Window.Current.Content = newFrame;
                Window.Current.Activate();
            });

            await Windows.UI.ViewManagement.ApplicationViewSwitcher.TryShowAsStandaloneAsync(newAppView.Id);
        }
    }
示例#9
0
 static async void Responsive(ApplicationView sender)
 {
     if (DisplayHelper.IsPortrait())
     {
         var screenHeight = Window.Current.Bounds.Height;
         var statusBarHeight = OccludedRect.Height;
         var tmpAppViewHeight = screenHeight - statusBarHeight;
         var navBarHeight = tmpAppViewHeight - sender.VisibleBounds.Height;
         var rect = OccludedRect;
         App.SplitShell.Margin = new Thickness(0, statusBarHeight, 0, navBarHeight);
     }
     else
     {
         var screenWidth = Window.Current.Bounds.Width;
         var tmpAppViewWidth = sender.VisibleBounds.Width;
         double navBarWidth;
         navBarWidth = screenWidth - tmpAppViewWidth;
         App.SplitShell.Margin = new Thickness((sender.VisibleBounds.Left > 0) ? navBarWidth : 0,
                                                        0,
                                                        (sender.VisibleBounds.Left > 0) ? 0 : navBarWidth,
                                                        0);
     }
 }
示例#10
0
 private void OnVisibleBoundsChanged(ApplicationView sender, object args)
 {
     this.ShowHide();
 }
 private void OnBoundsChanged(ApplicationView sender, object args)
 {
     Context.GetJavaScriptModule<RCTDeviceEventEmitter>()
         .emit("didUpdateDimensions", GetDimensions());
 }
示例#12
0
 // A view is consolidated with other views hen there's no way for the user to get to it (it's not in the list of recently used apps, cannot be
 // launched from Start, etc.) A view stops being consolidated when it's visible--at that point the user can interact with it, move it on or off screen, etc. 
 // It's generally a good idea to close a view after it has been consolidated, but keep it open while it's visible.
 private void ViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs e)
 {
     StopViewInUse();
 }
 private void AppView_VisibleBoundsChanged(ApplicationView sender, object args)
 {
     sv.Width = sender.VisibleBounds.Width;
     sv.Height = sender.VisibleBounds.Height;
 }
示例#14
0
		private void OnDropDownButton_Tapped(object sender, TappedRoutedEventArgs e)
		{
			if (_listView == null || _flyout == null) return;

			if (ListItemTemplate != null) _listView.ItemTemplate = ListItemTemplate;
			_listView.ItemsSource = ItemsSource;

			if (_popupBorder != null)
			{
				if (_appView == null) _appView = ApplicationView.GetForCurrentView();
				_popupBorder.MaxHeight = _appView.VisibleBounds.Height;
				_popupBorder.MaxWidth = _appView.VisibleBounds.Width;
			}

			try
			{
				_flyout.ShowAt(this);
			}
			catch { }
		}
 private void ApplicationView_VisibleBoundsChanged(ApplicationView sender, object args)
 {
     ResetApplicationViewVisibleMargin(sender);
 }
 // A view is consolidated with other views hen there's no way for the user to get to it (it's not in the list of recently used apps, cannot be
 // launched from Start, etc.) A view stops being consolidated when it's visible--at that point the user can interact with it, move it on or off screen, etc. 
 // It's generally a good idea to close a view after it has been consolidated, but keep it open while it's visible.
 private void ViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs e)
 {
     Consolidated = true;
 }
 private void ReadingPage_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
 }
示例#18
0
        public void Initialize(CoreWindow coreWindow, UIElement inputElement, TouchQueue touchQueue)
        {
            _coreWindow = coreWindow;
            _windowEvents = new InputEvents(_coreWindow, inputElement, touchQueue);

			_dinfo = DisplayInformation.GetForCurrentView();
            _appView = ApplicationView.GetForCurrentView();

            // Set a min size that is reasonable knowing someone might try
            // to use some old school resolution like 640x480.
            var minSize = new Windows.Foundation.Size(640 / _dinfo.RawPixelsPerViewPixel, 480 / _dinfo.RawPixelsPerViewPixel);
            _appView.SetPreferredMinSize(minSize);

            _orientation = ToOrientation(_dinfo.CurrentOrientation);
            _dinfo.OrientationChanged += DisplayProperties_OrientationChanged;
            _swapChainPanel = inputElement as SwapChainPanel;

            _swapChainPanel.SizeChanged += SwapChain_SizeChanged;

            _coreWindow.Closed += Window_Closed;
            _coreWindow.Activated += Window_FocusChanged;
			_coreWindow.CharacterReceived += Window_CharacterReceived;

            SetViewBounds(_appView.VisibleBounds.Width, _appView.VisibleBounds.Height);

            SetCursor(false);
        }
示例#19
0
		public LolloChart()
		{
			InitializeComponent();
			_appView = ApplicationView.GetForCurrentView();
			_prevOrientation = _appView.Orientation;

			//DataContext = this;
			SetLineStyles();
			// LOLLO NOTE the buttons respond at once, the manipulations instead are slow. Their speed improves if I only set a couple.
			// I need to catch TranslateY so I can compare X e Y and do nothing is Abs(Y) > Abs(X)
			GridChartArea.ManipulationMode = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY;
		}
示例#20
0
 private static void StatusBarHelper_VisibleBoundsChanged(ApplicationView sender, object args)
 {
     Responsive(sender);
 }
		protected virtual void OnVisibleBoundsChangedMayOverride(ApplicationView sender, object args) { }
示例#22
0
		protected override void OnVisibleBoundsChangedMayOverride(ApplicationView sender, object args)
		{
			if (IsPopupOpen)
			{
				IsPopupOpen = false;
				// UpdatePopupSizeAndPlacement(); // this screws up, let's just close the popup for now
			}
		}
示例#23
0
 void IApplicationViewEventSink.OnVisibleBoundsChanged(ApplicationView sender, object args)
 {
     CalculateMargin();
 }
示例#24
0
        private void OnVisibleBoundsChanged(ApplicationView sender, object args)
        {
            var bounds = ApplicationView.GetForCurrentView().VisibleBounds;
            var h = Window.Current.Bounds.Height;

            var diff = Math.Ceiling(h - bounds.Bottom);
            RootFrame.Margin = new Thickness(0, 0, 0, diff);
        }
示例#25
0
 void IApplicationViewEventSink.OnConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
 }
示例#26
0
 private void MasterDetailStatetateTrigger_MasterDetailStateChanged(ApplicationView sender, object args)
 {
     UpdateTrigger();
 }
        private void ResetApplicationViewVisibleMargin(ApplicationView applicationView)
        {
            if (_rootGrid == null)
            {
                return;
            }

            var bounds = Window.Current.Bounds;
            var visibleBounds = applicationView.VisibleBounds;

            var applicationViewVisibleMargin = new Thickness(visibleBounds.Left - bounds.Left, visibleBounds.Top - bounds.Top, bounds.Right - visibleBounds.Right, bounds.Bottom - visibleBounds.Bottom);

            if (!_rootGrid.Margin.Equals(applicationViewVisibleMargin))
            {
                _rootGrid.Margin = applicationViewVisibleMargin;
            }
        }
示例#28
0
		private void OnAppView_VisibleBoundsChanged(ApplicationView sender, object args)
		{
			if (Visibility == Visibility.Visible && _appView.Orientation != _prevOrientation)
			{
				_prevOrientation = _appView.Orientation;
				InvalidateMeasure();
			}
		}
		public DocumentView()
		{
			_appView = ApplicationView.GetForCurrentView(); _appView.VisibleBoundsChanged += OnVisibleBoundsChanged;
			_renderSemaphore = new SemaphoreSlimSafeRelease(1, 1);
			Loaded += OnLoaded;
			Unloaded += OnUnloaded;
			InitializeComponent();
		}
 public MainPage()
 {
     appView = ApplicationView.GetForCurrentView();
     this.InitializeComponent();
 }
		private void OnVisibleBoundsChanged(ApplicationView sender, object args)
		{
			UpdateAdjustedSizes();
		}
 private void OnVisibleBoundsChanged(ApplicationView sender, object args)
 {
     EvaluateLayout();
 }
示例#33
0
文件: Header.cs 项目: liquidboy/X
        public void InitChrome(Application app, ApplicationView applicationView)
        {
            app.DebugSettings.IsTextPerformanceVisualizationEnabled = false;
            app.DebugSettings.IsBindingTracingEnabled = false;
            app.DebugSettings.IsOverdrawHeatMapEnabled = false;
            app.DebugSettings.EnableFrameRateCounter = false;


            var titleBar = applicationView.TitleBar;

            titleBar.BackgroundColor = Colors.Transparent;
            titleBar.ForegroundColor = Colors.Black;

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            titleBar.ButtonBackgroundColor = Colors.Transparent;
            titleBar.ButtonForegroundColor = Colors.Black;
            titleBar.InactiveBackgroundColor = Colors.Transparent;
            titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

        }