void GroupedItemsPage_CommandsRequested(Windows.UI.ApplicationSettings.SettingsPane sender, Windows.UI.ApplicationSettings.SettingsPaneCommandsRequestedEventArgs args)
        {
            
             
                SettingsCommand cmd = new SettingsCommand("Accounts", "Account", (x) =>
                    {
                        _settingsPopup = new Popup();
                        _settingsPopup.Closed += OnPopupClosed;
                        Window.Current.Activated += OnWindowActivated;
                        _settingsPopup.IsLightDismissEnabled = true;
                        _settingsPopup.Width = _settingsWidth;
                        _settingsPopup.Height = _windowBounds.Height;

                        SimpleSettingsNarrow mypane = new SimpleSettingsNarrow();
                        mypane.Width = _settingsWidth;
                        mypane.Height = _windowBounds.Height;

                        _settingsPopup.Child = mypane;
                        _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth);
                        _settingsPopup.SetValue(Canvas.TopProperty, 0);
                        _settingsPopup.IsOpen = true;
                    });

                args.Request.ApplicationCommands.Add(cmd);
            

        }
예제 #2
0
        public void Open(object parameter, Action successAction)
        {
            // Create a new Popup to display the Flyout
            _popup = new Popup();
            _popup.IsLightDismissEnabled = true;
            _popup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - FlyoutSize);
            _popup.SetValue(Canvas.TopProperty, 0);

            // Handle the Closed & Activated events of the Popup
            _popup.Closed += OnPopupClosed;
            Window.Current.Activated += OnWindowActivated;

            // Update the Flyout dimensions
            Width = FlyoutSize;
            Height = Window.Current.Bounds.Height;

            // Add animations for the panel.
            _popup.ChildTransitions = new TransitionCollection();
            _popup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left
            });

            // Place the Flyout inside the Popup
            _popup.Child = this;
            _popup.IsOpen = true;

            var viewModel = this.DataContext as IFlyoutViewModel;
            if (viewModel != null)
            {
                viewModel.Open(parameter, successAction);
            }
        }
        private void OpenLoginPopUp(bool open)
        {
            if (!open)
            {
                if (loginPopUp != null)
                    loginPopUp.IsOpen = false;

                return;
            }

            var windowBounds = Window.Current.Bounds;

            loginPopUp = new Popup()
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                Width = 500,
                Height = 310,
                IsLightDismissEnabled = false,
                IsOpen = true
            };

            loginPopUp.Child = new LoginView();

            loginPopUp.SetValue(Popup.HorizontalOffsetProperty, 600);
            loginPopUp.SetValue(Popup.VerticalOffsetProperty, 300);

            loginPopUp.Closed += _loginPopup_Closed;
        }
 void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
 {
     args.Request.ApplicationCommands.Clear();
     SettingsCommand settingsCommand = new SettingsCommand("settings", "Settings", (x) =>
     {
         _settingsPopup = new Popup();
         _settingsPopup.Closed += _settingsPopup_Closed;
         Window.Current.Activated += Current_Activated;
         _settingsPopup.IsLightDismissEnabled = true;
         _settingsPopup.Width = _settingsWidth;
         _settingsPopup.Height = _windowBounds.Height;
         SettingsUserControl settingsPane = new SettingsUserControl();
         settingsPane.Width = _settingsWidth;
         settingsPane.Height = _windowBounds.Height;
         _settingsPopup.Child = settingsPane;
         _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth);
         _settingsPopup.SetValue(Canvas.TopProperty, 0);
         _settingsPopup.IsOpen = true;
     });
     SettingsCommand privacyPolicyCommand = new SettingsCommand("privacyPolicy", "Privacy Policy", (x) =>
     {
         _settingsPopup = new Popup();
         _settingsPopup.Closed += _settingsPopup_Closed;
         Window.Current.Activated += Current_Activated;
         _settingsPopup.IsLightDismissEnabled = true;
         _settingsPopup.Width = _settingsWidth;
         _settingsPopup.Height = _windowBounds.Height;
         PrivacyPolicy settingsPane = new PrivacyPolicy();
         settingsPane.Width = _settingsWidth;
         settingsPane.Height = _windowBounds.Height;
         _settingsPopup.Child = settingsPane;
         _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth);
         _settingsPopup.SetValue(Canvas.TopProperty, 0);
         _settingsPopup.IsOpen = true;
     });
     SettingsCommand registerCommand = new SettingsCommand("register", "Register", (x) =>
     {
         _settingsPopup = new Popup();
         _settingsPopup.Closed += _settingsPopup_Closed;
         Window.Current.Activated += Current_Activated;
         _settingsPopup.IsLightDismissEnabled = true;
         _settingsPopup.Width = _settingsWidth;
         _settingsPopup.Height = _windowBounds.Height;
         RegisterUser settingsPane = new RegisterUser();
         settingsPane.Width = _settingsWidth;
         settingsPane.Height = _windowBounds.Height;
         _settingsPopup.Child = settingsPane;
         _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth);
         _settingsPopup.SetValue(Canvas.TopProperty, 0);
         _settingsPopup.IsOpen = true;
     });
     args.Request.ApplicationCommands.Add(settingsCommand);
     args.Request.ApplicationCommands.Add(registerCommand);
     args.Request.ApplicationCommands.Add(privacyPolicyCommand);
 }
예제 #5
0
        private void SettingsCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            SettingsCommand about_cmd = new SettingsCommand("about", "About", (x) =>
            {
                _settingsPopup = new Popup();
                _settingsPopup.Closed += OnPopupClosed;
                Window.Current.Activated += OnWindowActivated;
                _settingsPopup.IsLightDismissEnabled = true;
                _settingsPopup.Width = _settingsWidth;
                _settingsPopup.Height = _windowBounds.Height;

                SettingsAboutView mypane = new SettingsAboutView();
                //SimpleSettingsNarrow mypane = new SimpleSettingsNarrow();
                mypane.Width = _settingsWidth;
                mypane.Height = _windowBounds.Height;

                _settingsPopup.Child = mypane;
                _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth);
                _settingsPopup.SetValue(Canvas.TopProperty, 0);
                _settingsPopup.IsOpen = true;
            });

            args.Request.ApplicationCommands.Add(about_cmd);

            SettingsCommand logout_cmd = new SettingsCommand("logout", "Log out", (x) =>
            {
                var vault = new PasswordVault();
                vault.Remove(vault.Retrieve("Sovok.tv WinApp", App.ViewModel.UserAccount.login));
                bool nav = Frame.Navigate(typeof(Login));
                App.ViewModel = new Model.MainViewModel();
            });

            args.Request.ApplicationCommands.Add(logout_cmd);

            SettingsCommand settings_cmd = new SettingsCommand("settings", "Settings", (x) =>
            {
                _settingsPopup = new Popup();
                _settingsPopup.Closed += OnPopupClosed;
                Window.Current.Activated += OnWindowActivated;
                _settingsPopup.IsLightDismissEnabled = true;
                _settingsPopup.Width = _settingsWidth;
                _settingsPopup.Height = _windowBounds.Height;

                SettingsView mypane = new SettingsView();
                mypane.Width = _settingsWidth;
                mypane.Height = _windowBounds.Height;

                _settingsPopup.Child = mypane;
                _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth);
                _settingsPopup.SetValue(Canvas.TopProperty, 0);
                _settingsPopup.IsOpen = true;
            });
            args.Request.ApplicationCommands.Add(settings_cmd);
        }
예제 #6
0
        public ItemViewModel ()
        {
            assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();

            saveAssignmentItemCommand = new DelegateCommand (obj => {
                var item = obj as AssignmentItem;
                if (item != null && assignmentViewModel.SelectedAssignment != null) {
                    SaveAssignmentItemAsync (assignmentViewModel.SelectedAssignment, item);
                }
            });

            searchItemsCommand = new DelegateCommand (async _ => {
                await LoadItemsAsync ();
                var items = new List<Item> ();
                foreach (var item in Items) {
                    if (item.Name.ToLower ().Contains (SearchText.ToLower ()) || item.Number.ToLower ().Contains (SearchText.ToLower ())) {
                        items.Add (item);
                    }
                }
                SearchItems = items;
            });

            addItemCommand = new DelegateCommand (_ => {
                if (addItemPopUp != null && addItemPopUp.IsOpen) {
                    addItemPopUp.IsOpen = false;
                }
                addItemPopUp = new Popup ();
                addItemPopUp.Height = Window.Current.Bounds.Height;
                addItemPopUp.Width = Constants.PopUpWidth;
                AddItemFlyoutPanel flyoutpanel = new AddItemFlyoutPanel ();
                flyoutpanel.Width = addItemPopUp.Width;
                flyoutpanel.Height = addItemPopUp.Height;
                addItemPopUp.Child = flyoutpanel;
                addItemPopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
                addItemPopUp.SetValue (Canvas.TopProperty, 0);
                addItemPopUp.IsOpen = true;
                SearchText = string.Empty;
                SearchItemsCommand.Invoke ();
            });

            cancelAddItemCommand = new DelegateCommand (_ => {
                addItemPopUp.IsOpen = false;
            });

            deleteItemCommand = new DelegateCommand (async _ => {
                if (selectedItem != null) {
                    await DeleteAssignmentItemAsync (assignmentViewModel.SelectedAssignment, selectedItem);
                    await LoadAssignmentItemsAsync (assignmentViewModel.SelectedAssignment);
                }
            });
        }
예제 #7
0
 void onGeneralSettingsCommand(IUICommand command)
 {
     settingsPopup = setupSettings(settingsPopup);
     SettingsFlyout.StandardFlyout generalpane = new SettingsFlyout.StandardFlyout();
     generalpane.Width = settingsWidth;
     generalpane.Height = windowBounds.Height;
     // Place the SettingsFlyout inside our Popup window.
     settingsPopup.Child = generalpane;
     
     // Let's define the location of our Popup.
     settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
     settingsPopup.SetValue(Canvas.TopProperty, 0);
     settingsPopup.IsOpen = true;
 }
예제 #8
0
 void onHelpSettingsCommand(IUICommand command)
 {
     helpPopup = setupSettings(helpPopup);
     SettingsFlyout.HelpFlyout helppane = new SettingsFlyout.HelpFlyout();
     helppane.Width = settingsWidth;
     helppane.Height = windowBounds.Height;
     // Place the SettingsFlyout inside our Popup window.
     helpPopup.Child = helppane;
     
     // Let's define the location of our Popup.
     helpPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
     helpPopup.SetValue(Canvas.TopProperty, 0);
     helpPopup.IsOpen = true;
 }
 private void Handler(IUICommand command)
 {
     _popUp = new Popup
     {
         Width = WIDTH,
         Height = _window.Height,
         IsLightDismissEnabled = true,
         IsOpen = true
     };
     _popUp.Closed += OnPopupClosed;
     Window.Current.Activated += OnWindowActivated;
     _popUp.Child = new AboutSettings { Width = WIDTH, Height = _window.Height };
     _popUp.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (_window.Width - WIDTH) : 0);
     _popUp.SetValue(Canvas.TopProperty, 0);
 }
void BlankPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
    // 新建一个命令
    SettingsCommand cmd = new SettingsCommand("login", "登录", (x) =>
    {
        // 新建一个Popup,并将其宽度设置为346,高度与屏幕一致
        _settingsPopup = new Popup();
        _settingsPopup.Width = 346;
        _settingsPopup.Height = Window.Current.Bounds.Height;
        _settingsPopup.IsLightDismissEnabled = true;

        // 新建一个页面,并设置该页面的相关属性(大小,位置)
        LoginPane mypane = new LoginPane();
        mypane.Height = Window.Current.Bounds.Height;
        mypane.Width = 346;
        _settingsPopup.Child = mypane;
        _settingsPopup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - 346);
        _settingsPopup.IsOpen = true;
    });

    args.Request.ApplicationCommands.Add(cmd);

    SettingsCommand cmd1 = new SettingsCommand("logout", "注销", (x) =>
    {
    });

    args.Request.ApplicationCommands.Add(cmd1);
}
        private void OpenPopup(int width, UserControl child)
        {
            var settingsPopup = new Popup
            {
                IsLightDismissEnabled = true,
                Width = width,
                Height = Window.Current.Bounds.Height
            };

            child.Width = width;
            child.Height = Window.Current.Bounds.Height;
            settingsPopup.Child = child;
            settingsPopup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - width);
            settingsPopup.SetValue(Canvas.TopProperty, 0);
            settingsPopup.IsOpen = true;
        }
        public static Popup BuildSettingsItem(UserControl userControl, int width)
        {
            var popup = new Popup();

            popup.IsLightDismissEnabled = true;
            userControl.Width = width;
            userControl.Height = Window.Current.Bounds.Height;

            popup.Child = userControl;

            popup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - width);
            popup.SetValue(Canvas.TopProperty, 0);
            popup.IsOpen = true;

            return popup;
        }
예제 #13
0
        /// <summary>
        /// Creates a new instance of <see cref="SettingsWindow"/>
        /// </summary>
        /// <param name="applicationBoundingRectangle">The bounding rectangle of the parent application.</param>
        /// <param name="settingsElement">The element that will be wrapped by the <see cref="SettingsWindow"/>.</param>
        /// <param name="settingWidth">The width of the settings pane.  Defaults to 346px.</param>
        private SettingsWindow(Rect applicationBoundingRectangle, FrameworkElement settingsElement, double settingWidth = 346)
        {
            _settingsPopup = new Popup();
            _settingsPopup.Closed += (s, e) => Window.Current.Activated -= OnWindowActivated;
            Window.Current.Activated += OnWindowActivated;
            _settingsPopup.IsLightDismissEnabled = true;
            _settingsPopup.Width = settingWidth;
            _settingsPopup.Height = applicationBoundingRectangle.Height;

            settingsElement.Width = settingWidth;
            settingsElement.Height = applicationBoundingRectangle.Height;

            _settingsPopup.Child = settingsElement;
            _settingsPopup.SetValue(Canvas.LeftProperty, applicationBoundingRectangle.Width - settingWidth);
            _settingsPopup.SetValue(Canvas.TopProperty, 0);
            _settingsPopup.IsOpen = true;
        }
예제 #14
0
        /// <summary>
        /// Display a user control inside a screen popup window
        /// </summary>
        /// <param name="control"></param>
        public void ShowFlyout(UserControl control)
        {
            _popup = new Popup();
            _popup.Closed += OnPopupClosed;
            Window.Current.Activated += OnWindowActivated;
            _popup.IsLightDismissEnabled = true;
            _popup.Width = _width;
            _popup.Height = Window.Current.Bounds.Height;

            control.Width = _width;
            control.Height = Window.Current.Bounds.Height;

            _popup.Child = control;
            _popup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - _width);
            _popup.SetValue(Canvas.TopProperty, 0);
            _popup.IsOpen = true;
        }
예제 #15
0
 public LaborViewModel ()
 {
     assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel> ();
     cancelAddLaborCommand = new DelegateCommand (_ => {
         addLaborPopUp.IsOpen = false;
     });
     saveAddLaborCommand = new DelegateCommand (async _ => {
         selectedLabor.Hours = TimeSpan.FromHours (currentLaborHours.ToDouble (CultureInfo.InvariantCulture));
         selectedLabor.AssignmentId = assignmentViewModel.SelectedAssignment.Id;
         await SaveLaborAsync (assignmentViewModel.SelectedAssignment, selectedLabor);
         await LoadLaborHoursAsync (assignmentViewModel.SelectedAssignment);
         addLaborPopUp.IsOpen = false;
     });
     deleteAddLaborCommand = new DelegateCommand (async _ => {
         await DeleteLaborAsync (assignmentViewModel.SelectedAssignment, selectedLabor);
         await LoadLaborHoursAsync (assignmentViewModel.SelectedAssignment);
         addLaborPopUp.IsOpen = false;
     });
     addLaborCommand = new DelegateCommand (obj => {
         var labor = obj as Labor;
         if (labor != null) {
             SelectedLabor = labor;
             AddLaborHeader = "Labor";
             CanDelete = true;
         } else {
             SelectedLabor = new Labor ();
             AddLaborHeader = "Add Labor";
             CanDelete = false;
         }
         if (addLaborPopUp != null && addLaborPopUp.IsOpen) {
             addLaborPopUp.IsOpen = false;
         }
         addLaborPopUp = new Popup ();
         addLaborPopUp.Height = Window.Current.Bounds.Height;
         addLaborPopUp.Width = Constants.PopUpWidth;
         AddLaborFlyoutPanel flyoutpanel = new AddLaborFlyoutPanel ();
         flyoutpanel.Width = addLaborPopUp.Width;
         flyoutpanel.Height = addLaborPopUp.Height;
         addLaborPopUp.Child = flyoutpanel;
         addLaborPopUp.SetValue (Canvas.LeftProperty, Window.Current.Bounds.Width - Constants.PopUpWidth);
         addLaborPopUp.SetValue (Canvas.TopProperty, 0);
         addLaborPopUp.IsOpen = true;
     });
 }
예제 #16
0
        /// <summary>
        /// Called to present the flyout view.
        /// </summary>
        /// <param name="parameter">Optional parameter for the caller to pass into the view.</param>
        /// <param name="successAction">Method to be invoked on successful completion of the user task in the flyout.</param>
        public void Open(object parameter, Action successAction)
        {
            // Create a new Popup to display the Flyout
            _popup = new Popup();
            _popup.IsLightDismissEnabled = true;
            _popup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - FlyoutSize);
            _popup.SetValue(Canvas.TopProperty, 0);

            // Handle the Closed & Activated events of the Popup
            _popup.Closed += OnPopupClosed;
            Window.Current.Activated += OnWindowActivated;

            // Update the Flyout dimensions
            Width = FlyoutSize;
            Height = Window.Current.Bounds.Height;

            // Add animations for the panel.
            _popup.ChildTransitions = new TransitionCollection();
            _popup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left
            });

            // Place the Flyout inside the Popup and open it
            _popup.Child = this;
            _popup.IsOpen = true;

            // If the Flyout has a DataContext, call the viewModel.Open method and set the set the Close and GoBack actions for future use
            var viewModel = DataContext as IFlyoutViewModel;
            if (viewModel != null)
            {
                viewModel.CloseFlyout = Close;
                viewModel.GoBack = GoBack;
                viewModel.Open(parameter, successAction);
            }

            // If SearchOnKeyboardInput is enabled, disable it. Also, save the current state
            _wasSearchOnKeyboardInputEnabled = _searchPaneService.IsShowOnKeyBoardInputEnabled();
            if (_wasSearchOnKeyboardInputEnabled)
            {
                _searchPaneService.ShowOnKeyboardInput(false);
            }
        }
예제 #17
0
        public static Popup Create(UserControl element, double width)
        {
            Popup p = new Popup();
            p.Child = element;
            p.IsLightDismissEnabled = true;
            p.ChildTransitions = new TransitionCollection();
            p.ChildTransitions.Add(new PaneThemeTransition()    //声明边缘 UI(如应用程序栏)的边缘转换位置。
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
                        EdgeTransitionLocation.Right :
                        EdgeTransitionLocation.Left
            });//检查SettingsPane的edge,有些国家的超级菜单在左边。

            element.Width = width;
            element.Height = Window.Current.Bounds.Height;
            p.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (Window.Current.Bounds.Width - width) : 0);//设置距离左边的边距
            p.SetValue(Canvas.TopProperty, 0);
            return p;
        }
        private void btnHome1_Click(object sender, RoutedEventArgs e)
        {
            settingsPopup = new Popup();
            Rect windowsBounds = Window.Current.Bounds;
            settingsPopup.Closed += settingsPopup_Closed;
            Window.Current.Activated += Current_Activated;

            settingsPopup.IsLightDismissEnabled = true;
            settingsPopup.Height = windowsBounds.Height;
            myCartPage cartPage = new myCartPage();

            cartPage.Height = windowsBounds.Height;

            settingsPopup.Child = cartPage;
            settingsPopup.SetValue(Canvas.LeftProperty, windowsBounds.Width - 425);
            settingsPopup.SetValue(Canvas.TopProperty, 0);

            settingsPopup.IsOpen = true;
        }
예제 #19
0
        private Popup BuildSettingsItem(UserControl userControl, int width)
        {
            Popup popup = new Popup();
            popup.IsLightDismissEnabled = true;
            popup.ChildTransitions = new TransitionCollection();
            popup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
                        EdgeTransitionLocation.Right :
                        EdgeTransitionLocation.Left
            });
            userControl.Width = width;
            userControl.Height = Window.Current.Bounds.Height;
            popup.Child = userControl;

            popup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (Window.Current.Bounds.Width - width) : 0);
            popup.SetValue(Canvas.TopProperty, 0);

            return popup;
        }
        private void OpenUserIDPage(IUICommand command)
        {
            string _userid = APIMASHGlobals.Instance.UserID;

            m_useridPopup = new Popup();
            m_useridPopup.Closed += UseridPopup_Closed;
            Window.Current.Activated += OnUserIdPanelActivated;

            m_useridPopup.IsLightDismissEnabled = true;
            m_useridPopup.Width = m_CharmsFlyoutWidth;
            m_useridPopup.Height = m_windowBounds.Height;

            UserIdUserControl _mypane = new UserIdUserControl();
            _mypane.Width = m_CharmsFlyoutWidth;
            _mypane.Height = m_windowBounds.Height;

            m_useridPopup.Child = _mypane;
            m_useridPopup.SetValue(Canvas.LeftProperty, m_windowBounds.Width - m_CharmsFlyoutWidth);
            m_useridPopup.SetValue(Canvas.TopProperty, 0);
            m_useridPopup.IsOpen = true;
        }
예제 #21
0
    public LineItemEditor(object sender, BusinessLibrary.LineItem item)
    {
      this.InitializeComponent();

      Container = new Popup();
      Item = item;
      var rect = GetElementRect((FrameworkElement)sender);

      Container.Child = this;

      this.Height = rect.Height;
      this.Width = rect.Width;
      Container.Height = this.Height;
      Container.Width = this.Width;
      Container.IsLightDismissEnabled = false;

      Container.ChildTransitions = new TransitionCollection();
      Container.ChildTransitions.Add(new PopupThemeTransition());

      Container.SetValue(Canvas.LeftProperty, rect.Left);
      Container.SetValue(Canvas.TopProperty, rect.Top);
    }
예제 #22
0
        public SettingsFlyout()
        {
            DefaultStyleKey = typeof(SettingsFlyout);

            _windowBounds = Window.Current.Bounds;

            Loaded += OnLoaded;

            _hostPopup = new Popup { ChildTransitions = new TransitionCollection { new PaneThemeTransition() } };
            _hostPopup.Closed += OnHostPopupClosed;
            _hostPopup.IsLightDismissEnabled = true;
            _hostPopup.Height = _windowBounds.Height;
            _hostPopup.Child = this;
            _hostPopup.SetValue(Canvas.TopProperty, 0);

            Height = _windowBounds.Height;
        }
예제 #23
0
        public SettingsFlyout()
        {
            this.DefaultStyleKey = typeof(SettingsFlyout);

            Window.Current.Activated += OnCurrentWindowActivated;

            _windowBounds = Window.Current.Bounds;

            this.Loaded += OnLoaded;

            _hostPopup = new Popup();
            _hostPopup.Closed += OnHostPopupClosed;
            _hostPopup.IsLightDismissEnabled = true;
            _hostPopup.Height = _windowBounds.Height;
            _hostPopup.Child = this;
            _hostPopup.SetValue(Canvas.TopProperty, 0);

            this.Height = _windowBounds.Height;
        }
예제 #24
0
        public SettingsFlyout()
        {
            this.DefaultStyleKey = typeof(SettingsFlyout);

            _windowBounds = Window.Current.Bounds;

            this.Loaded += OnLoaded;

            _hostPopup = new Popup();
            _hostPopup.ChildTransitions = new TransitionCollection();
            _hostPopup.ChildTransitions.Add(new PaneThemeTransition() { Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left });
            _hostPopup.Closed += OnHostPopupClosed;
            _hostPopup.IsLightDismissEnabled = true;
            _hostPopup.Height = _windowBounds.Height;
            _hostPopup.Child = this;
            _hostPopup.SetValue(Canvas.TopProperty, 0);

            this.Height = _windowBounds.Height;
        }
예제 #25
0
        public void Settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            SettingsCommand cmd = new SettingsCommand("advancedConfiguration", "Configurações Avançadas", (x) =>
            {
                _settingsPopup = new Popup();
                _settingsPopup.Closed += OnPopupClosed;
                Window.Current.Activated += OnWindowActivated;
                _settingsPopup.IsLightDismissEnabled = true;
                _settingsPopup.Width = 400;
                _settingsPopup.Height = Window.Current.Bounds.Height;

                ExpenseSettings mypane = new ExpenseSettings();
                mypane.Width = 400;
                mypane.Height = Window.Current.Bounds.Height;

                _settingsPopup.Child = mypane;
                Canvas.SetLeft(_settingsPopup, Window.Current.Bounds.Width - _settingsPopup.Width + 5);
                // _settingsPopup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - _settingsPopup.Width);
                _settingsPopup.SetValue(Canvas.TopProperty, 0);
                _settingsPopup.IsOpen = true;
            });

            args.Request.ApplicationCommands.Add(cmd);
        }
예제 #26
0
        void onSettingsCommand(IUICommand command)
        {
            SettingsCommand settingsCommand = (SettingsCommand)command;
            // Create a Popup window which will contain our flyout.
            settingsPopup = new Popup();
            settingsPopup.Closed += OnPopupClosed;
            Window.Current.Activated += OnWindowActivated;
            settingsPopup.IsLightDismissEnabled = true;
            settingsPopup.Width = settingsWidth;
            settingsPopup.Height = windowBounds.Height;

            // Add the proper animation for the panel.
            settingsPopup.ChildTransitions = new TransitionCollection();
            settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
                       EdgeTransitionLocation.Right :
                       EdgeTransitionLocation.Left
            });

            // Create a SettingsFlyout the same dimenssions as the Popup.
            SettingsFlyout mypane = new SettingsFlyout();
            mypane.Width = settingsWidth;
            mypane.Height = windowBounds.Height;

            // Place the SettingsFlyout inside our Popup window.
            settingsPopup.Child = mypane;

            // Let's define the location of our Popup.
            settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
            settingsPopup.SetValue(Canvas.TopProperty, 0);
            settingsPopup.IsOpen = true;
        }
예제 #27
0
        private void ShowSettingsFlyout(UserControl content)
        {
            settingsPopup = new Popup();

            settingsPopup.Closed += popup_Closed;
            Window.Current.Activated += Current_Activated;

            settingsPopup.IsLightDismissEnabled = true;
            settingsPopup.Width = settingsFlyoutWidth;
            settingsPopup.Height = windowBounds.Height;

            settingsPopup.ChildTransitions = new TransitionCollection();
            settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left
            });

            content.Width = settingsFlyoutWidth;
            content.Height = windowBounds.Height;

            settingsPopup.Child = content;

            settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? windowBounds.Width - settingsFlyoutWidth : 0);
            settingsPopup.SetValue(Canvas.TopProperty, 0);

            settingsPopup.IsOpen = true;
        }
예제 #28
0
        public void Show()
        {
            _popup = new Popup
            {
                IsLightDismissEnabled = false
            };
            _popup.SetValue(Canvas.TopProperty, 0);
            _popup.SetValue(Canvas.LeftProperty, 0);
            _popup.Loaded += OnPopupLoaded;
            _popup.Closed += OnPopupClosed;

            Window.Current.Activated += OnWindowActivated;

            _popup.ChildTransitions = new TransitionCollection
            {
                new PopupThemeTransition()
            };

            Height = PopupHeight;
            Width = Window.Current.Bounds.Width;

            Canvas layoutRoot = new Canvas();
            layoutRoot.SetValue(WidthProperty, Window.Current.Bounds.Width);
            layoutRoot.SetValue(HeightProperty, Window.Current.Bounds.Height);
            layoutRoot.Background = _backgroundBrush;
            layoutRoot.Children.Add(this);
            SetValue(Canvas.TopProperty, (Window.Current.Bounds.Height - PopupHeight) / 2);

            _popup.Child = layoutRoot;
            _popup.IsOpen = true;

            _viewModel = DataContext as ViewModelBase;
            if (_viewModel != null)
            {
                _viewModel.OnNavigatedTo(new NavigationArgs(NavigationArgs.NavigationMode.New), ParametersKey);
            }
        }
예제 #29
0
        private void onSettingsCommand(IUICommand command)
        {
            Rect windowBounds = Window.Current.Bounds;
            settingsPopup = new Popup();

            settingsPopup.Closed += settingsPopup_Closed;
            Window.Current.Activated += Current_Activated;
            settingsPopup.IsLightDismissEnabled = true;
            Page settingPage = null;

            switch (command.Id.ToString())
            {
                case "AU":
                    settingPage = new AboutUs();
                    break;
                case "CU":
                    settingPage = new ContactUs();
                    break;
                case "PP":
                    settingPage = new PrivacyPolicy();
                    break;
                case "TC":
                    settingPage = new TermsAndConditions();
                    break;
            }

            settingsPopup.Width = settingsWidth;
            settingsPopup.Height = windowBounds.Height;

            // Add the proper animation for the panel.
            settingsPopup.ChildTransitions = new TransitionCollection();
            settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
            {

                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
                EdgeTransitionLocation.Right :
                EdgeTransitionLocation.Left
            });

            if (settingPage != null)
            {
                settingPage.Width = settingsWidth;
                settingPage.Height = windowBounds.Height;
            }

            // Place the SettingsFlyout inside our Popup window.
            settingsPopup.Child = settingPage;

            // Let's define the location of our Popup.
            settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
            settingsPopup.SetValue(Canvas.TopProperty, 0);
            settingsPopup.IsOpen = true;
        }
예제 #30
0
파일: Flyout.cs 프로젝트: peterluo0822/Chat
        public Flyout(FlyoutType type, object data = null, Flyout parent = null, bool settingsPaneParent = false)
        {
            Parent = parent;
            SettingsPaneParent = settingsPaneParent;

            // Get bounds
            Rect WindowBounds = Window.Current.Bounds;
            double settingsWidth = GetFlyoutWidth(type);

            internalPopup = new Popup();
            internalPopup.Opened += OnPopupOpened;
            internalPopup.Closed += OnPopupClosed;


            // Popup settings
            internalPopup.IsLightDismissEnabled = true;
            internalPopup.Width = settingsWidth;
            internalPopup.Height = WindowBounds.Height;

            // Animations
            internalPopup.ChildTransitions = new TransitionCollection();
            internalPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? EdgeTransitionLocation.Right : EdgeTransitionLocation.Left
            });

            // FlyoutControl
            FlyoutControl ctlFlyout = new FlyoutControl(this, type, data);
            ctlFlyout.Width = settingsWidth;
            ctlFlyout.Height = WindowBounds.Height;
            internalPopup.Child = ctlFlyout;

            // Popup position
            internalPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (WindowBounds.Width - settingsWidth) : 0);
            internalPopup.SetValue(Canvas.TopProperty, 0);

            Show();

            if (Parent != null)
                Parent.Hide();
        }