Exemple #1
0
 private async void Page_KeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key.Equals(VirtualKey.Escape))
     {
         if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
         {
             await ApplicationView.GetForCurrentView().TryConsolidateAsync();
         }
         else
         {
             propertiesDialog?.Hide();
         }
     }
 }
        private async void InitializeUI()
        {
            if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
            {
                var statusBar = StatusBar.GetForCurrentView();
                await statusBar.HideAsync();
            }

            marketButton.Opacity       = 1;
            shoppingButton.Opacity     = 0.4;
            notificationButton.Opacity = 0.4;
            profileButton.Opacity      = 0.4;
            iframe.Navigate(typeof(Views.MarketsView));
        }
 private void InitMonitorList()
 {
     if (ApiInformation.IsApiContractPresent(typeof(Windows.Foundation.UniversalApiContract).FullName, 8))
     {
         var monitors = MonitorEnumerationHelper.GetMonitors();
         _monitors = new ObservableCollection <MonitorInfo>(monitors);
         MonitorComboBox.ItemsSource = _monitors;
     }
     else
     {
         MonitorComboBox.IsEnabled      = false;
         PrimaryMonitorButton.IsEnabled = false;
     }
 }
Exemple #4
0
        private static bool IsAdaptiveToastSupported()
        {
            switch (AnalyticsInfo.VersionInfo.DeviceFamily)
            {
            // Desktop and Mobile started supporting adaptive toasts in API contract 3 (Anniversary Update)
            case "Windows.Mobile":
            case "Windows.Desktop":
                return(ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3));

            // Other device families do not support adaptive toasts
            default:
                return(false);
            }
        }
        public static void ReplaceDialog(ContentDialog dlg, object sender)
        {
            if (MainPage.CurrentDialog != null)
            {
                MainPage.CurrentDialog.Hide();
            }
            MainPage.CurrentDialog = dlg;

            // Set the root of the dialog to the current view
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
            {
                dlg.XamlRoot = ((Button)sender).XamlRoot;
            }
        }
        public async Task <bool> IsWpsPushButtonAvailableAsync()
        {
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5, 0))
            {
                var result = await adapter.GetWpsConfigurationAsync(availableNetwork);

                if (result.SupportedWpsKinds.Contains(WiFiWpsKind.PushButton))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #7
0
 private async Task LaunchDesktopExtension()
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         try
         {
             await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
         }
         catch (Exception ex)
         {
             Debug.WriteLine(ex.Message);
         }
     }
 }
Exemple #8
0
        public App()
        {
            InitializeComponent();
            Suspending += OnSuspending;
            Container   = AutoFacConfiguration.Configure();

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3) &&
                DeviceHelper.GetDeviceType() == DeviceTypeEnum.Xbox)
            {
                RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested;
                EnteredBackground  += OnEnteredBackground;
                LeavingBackground  += OnLeavingBackground;
            }
        }
Exemple #9
0
 private async void SetDiscordRichPresence()
 {
     try
     {
         if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
         {
             await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
         }
     }
     catch (UnauthorizedAccessException e)
     {
         Debug.WriteLine("Couldn't Launch Discord Rich Presence.");
     }
 }
 public void SetStatusBar()
 {
     if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
     {
         var statusBar = StatusBar.GetForCurrentView();
         if (statusBar != null)
         {
             var background = GetSolidColorBrush("#FF147FD7").Color;
             statusBar.BackgroundOpacity = 1;
             statusBar.BackgroundColor   = background;
             statusBar.ForegroundColor   = Colors.White;
         }
     }
 }
 private void ShowMenu()
 {
     if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
     {
         FlyoutShowOptions myOption = new FlyoutShowOptions();
         myOption.ShowMode  = FlyoutShowMode.Transient;
         myOption.Placement = FlyoutPlacementMode.RightEdgeAlignedTop;
         CommandBarFlyout1.ShowAt(Image1, myOption);
     }
     else
     {
         CommandBarFlyout1.ShowAt(Image1);
     }
 }
Exemple #12
0
        public void DisplayImage(string uri, bool canAutoPlay)
        {
            var bitmap = new BitmapImage(new Uri(uri));

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3))
            {
                bitmap.AutoPlay = canAutoPlay;
            }

            var image = new Image();

            image.Source = bitmap;
            this.Content = image;
        }
        public static async Task OpenPropertiesWindowAsync(object item, IShellPage associatedInstance)
        {
            if (item == null)
            {
                return;
            }

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
            {
                CoreApplicationView newWindow = CoreApplication.CreateNewView();
                ApplicationView     newView   = null;

                await newWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    Frame frame = new Frame();
                    frame.Navigate(typeof(Properties), new PropertiesPageNavigationArguments()
                    {
                        Item = item,
                        AppInstanceArgument = associatedInstance
                    }, new SuppressNavigationTransitionInfo());
                    Window.Current.Content = frame;
                    Window.Current.Activate();

                    newView = ApplicationView.GetForCurrentView();
                    newWindow.TitleBar.ExtendViewIntoTitleBar = true;
                    newView.Title            = "PropertiesTitle".GetLocalized();
                    newView.PersistedStateId = "Properties";
                    newView.SetPreferredMinSize(new Size(460, 550));

                    bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newView.Id);
                    if (viewShown && newView != null)
                    {
                        // Set window size again here as sometimes it's not resized in the page Loaded event
                        newView.TryResizeView(new Size(460, 550));
                    }
                });
            }
            else
            {
                var propertiesDialog = new PropertiesDialog();
                propertiesDialog.propertiesFrame.Tag = propertiesDialog;
                propertiesDialog.propertiesFrame.Navigate(typeof(Properties), new PropertiesPageNavigationArguments()
                {
                    Item = item,
                    AppInstanceArgument = associatedInstance
                }, new SuppressNavigationTransitionInfo());
                await propertiesDialog.ShowAsync(ContentDialogPlacement.Popup);
            }
        }
Exemple #14
0
        private async void OnPageLoaded(object sender, RoutedEventArgs e)
        {
            // If we have a phone contract, hide the status bar
            if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
            {
                var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                await statusBar.HideAsync();

                //var sysNavManager = Windows.UI.Core.SystemNavigationManager.GetForCurrentView();
                //sysNavManager.AppViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.Collapsed;
            }

            _middleDirectionValue = (direction.Maximum - direction.Minimum) / 2;

            adaptiveLiftCheckBox.IsChecked            = true;
            adaptiveDirectionBoundsCheckBox.IsChecked = false;
            boostEnabledCheckBox.IsChecked            = true;
            propWhenTurningCheckBox.IsChecked         = true;
            directionByLiftButton.IsChecked           = false;

            ReadAdaptiveDirectionSettings();
            ReadAdaptiveLiftSettings();
            ReadBoostSettings();
            ReadPropWhenTurningSettings();

            _ackCounterStopwatch.Start();
            _controlTimer = new Timer(new TimerCallback(controlTimer_Tick), null, _controlIntervalMilliseconds, Timeout.Infinite);

            _elasticDirectionTimer          = new DispatcherTimer();
            _elasticDirectionTimer.Interval = TimeSpan.FromMilliseconds(_elasticDirectionTimerIntervalMilliseconds);
            _elasticDirectionTimer.Tick    += _elasticDirectionTimer_Tick;

            // Visual States are always on the first child of the control template
            var element = VisualTreeHelper.GetChild(this.direction, 0) as FrameworkElement;

            if (element != null)
            {
                _directionCommonStates = VisualStateManager.GetVisualStateGroups(element).FirstOrDefault(g => g.Name == "CommonStates");
                if (_directionCommonStates != null)
                {
                    //https://msdn.microsoft.com/fr-fr/library/windows/apps/mt299153.aspx
                    _directionCommonStates.CurrentStateChanged += _directionCommonStates_CurrentStateChanged;
                }
            }

            await RefreshWiFiNetworkName();

            NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;
        }
Exemple #15
0
        private async void OnStartSync()
        {
            //#if DEBUG
            await VoIPConnection.Current.ConnectAsync();

            //#endif

            await Toast.RegisterBackgroundTasks();

            BadgeUpdateManager.CreateBadgeUpdaterForApplication("App").Clear();
            TileUpdateManager.CreateTileUpdaterForApplication("App").Clear();
            ToastNotificationManager.History.Clear("App");

            if (SettingsHelper.UserId > 0 && ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 2) && JumpList.IsSupported())
            {
                var current = await JumpList.LoadCurrentAsync();

                current.SystemGroupKind = JumpListSystemGroupKind.None;
                current.Items.Clear();

                var cloud = JumpListItem.CreateWithArguments(string.Format("from_id={0}", SettingsHelper.UserId), Strings.Android.SavedMessages);
                cloud.Logo = new Uri("ms-appx:///Assets/JumpList/SavedMessages/SavedMessages.png");

                current.Items.Add(cloud);

                await current.SaveAsync();
            }

#if !DEBUG && !PREVIEW
            Execute.BeginOnThreadPool(async() =>
            {
                await new AppUpdateService().CheckForUpdatesAsync();
            });
#endif

            //if (ApiInformation.IsTypePresent("Windows.ApplicationModel.FullTrustProcessLauncher"))
            //{
            //    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
            //}

            try
            {
                // Prepare stuff for Cortana
                var localVoiceCommands = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommands/VoiceCommands.xml"));

                await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(localVoiceCommands);
            }
            catch { }
        }
Exemple #16
0
        private void HandleConnectedAnimation()
        {
            // Pre-fall creator has different image loading order
            // unable to share same connected animation code without breaking the UI
            if (!ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
            {
                return;
            }


            try
            {
                var container = FlipView.ContainerFromIndex(FlipView.SelectedIndex) as FlipViewItem;


                // Do not play the animation if the target flipview item is not actually in the middle
                // even if the SelectedIndex is pointing it, there are chance that the UI component is still not in the correct position
                var   transform        = container.TransformToVisual(FlipView);
                Point absolutePosition = transform.TransformPoint(new Point(0, 0));
                if ((int)absolutePosition.X != 0)
                {
                    return;
                }


                var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("PreviewImage");
                if (animation != null)
                {
                    if (FlipView.SelectedIndex >= 0)
                    {
                        var mainPreview = container.ContentTemplateRoot as Grid;
                        var srollViewer = mainPreview.Children.First() as ScrollViewer;
                        var imageGrid   = srollViewer.Content as Grid;
                        // Prepare backward connected animation
                        if (!animation.TryStart(imageGrid))
                        {
                            readyForConnectedAnimation = false;
                        }
                        else
                        {
                            readyForConnectedAnimation = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void ExpressionSample_Loaded(object sender, RoutedEventArgs e)
        {
            var anim = _compositor.CreateExpressionAnimation();

            anim.Expression = "Vector3(1/scaleElement.Scale.X, 1/scaleElement.Scale.Y, 1)";
            anim.Target     = "Scale";

            // Only establish the reference parameter if the API exists to do so.
            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
            {
                anim.SetExpressionReferenceParameter("scaleElement", rectangle);
            }

            StartAnimationIfAPIPresent(ellipse, anim);
        }
        void SetupImplicitTransitionsIfAPIAvailable()
        {
            // If the API is not present, simply no-op.
            if (!(ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7)))
            {
                return;
            }

            OpacityRectangle.OpacityTransition       = new ScalarTransition();
            RotationRectangle.RotationTransition     = new ScalarTransition();
            ScaleRectangle.ScaleTransition           = new Vector3Transition();
            TranslateRectangle.TranslationTransition = new Vector3Transition();
            BrushPresenter.BackgroundTransition      = new BrushTransition();
            ThemeExampleGrid.BackgroundTransition    = new BrushTransition();
        }
Exemple #19
0
        public NavigationService()
        {
            SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) =>
            {
                e.Handled = GoBack_Specific();
            };

            if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
            {
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }

            App.RootPage.NavigationFrame.Navigated += NavigationFrame_Navigated;
            HomePageNavigated += NavigationService_HomePageNavigated;
        }
Exemple #20
0
        private async Task AttachAsync()
        {
            if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1))
            {
                var devices = await DeviceInformation.FindAllAsync(ProximitySensor.GetDeviceSelector());

                if (devices.Count > 0)
                {
                    _sensor = ProximitySensor.FromId(devices[0].Id);
                    //_sensor.ReadingChanged += OnReadingChanged;

                    _controller = _sensor.CreateDisplayOnOffController();
                }
            }
        }
        private static async Task ClearJumpListAsync()
        {
            if (JumpList.IsSupported())
            {
                var list = await JumpList.LoadCurrentAsync();

                list.Items.Clear();
                await list.SaveAsync();
            }

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
            {
                await ContactListManager.ClearContactsAsync();
            }
        }
Exemple #22
0
        public static void OnFocusAcceptOrientationPropertyChanged(object sender, DependencyPropertyChangedEventArgs args)
        {
            // UIElement.GettingFocus is need UAC 4.0
            if (!ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4))
            {
                return;
            }

            if (sender is UIElement)
            {
                var fe = sender as UIElement;
                fe.GettingFocus -= OnTargetUIGettingFocus;
                fe.GettingFocus += OnTargetUIGettingFocus;
            }
        }
Exemple #23
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            InitializeComponent();
            Suspending += OnSuspending;

            //ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
            //ApplicationView.PreferredLaunchViewSize = new Size(300, 340);

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3))
            {
                FocusVisualKind = FocusVisualKind.Reveal;
            }

            DatabaseAccess.Initialize();
        }
Exemple #24
0
 private void InitWindowList()
 {
     if (ApiInformation.IsApiContractPresent(typeof(Windows.Foundation.UniversalApiContract).FullName, 8))
     {
         var processesWithWindows = from p in Process.GetProcesses()
                                    where !string.IsNullOrWhiteSpace(p.MainWindowTitle) && WindowEnumerationHelper.IsWindowValidForCapture(p.MainWindowHandle)
                                    select p;
         processes = new ObservableCollection <Process>(processesWithWindows);
         WindowComboBox.ItemsSource = processes;
     }
     else
     {
         WindowComboBox.IsEnabled = false;
     }
 }
Exemple #25
0
 private async void Button_Click(object sender, RoutedEventArgs e)
 {
     App.AppSettings.ThemeModeChanged -= AppSettings_ThemeModeChanged;
     if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8))
     {
         await propWindow.CloseAsync();
     }
     else
     {
         App.PropertiesDialogDisplay.Hide();
         _tokenSource.Cancel();
         _tokenSource.Dispose();
         _tokenSource = new CancellationTokenSource();
     }
 }
Exemple #26
0
        private void OpacityButton_Click(object sender, RoutedEventArgs e)
        {
            // If the implicit animation API is not present, simply no-op.
            if (!(ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7)))
            {
                return;
            }

            var customValue = Convert.ToDouble(OpacityTextBox.Text);

            if (customValue >= 0.0 && customValue <= 1.0)
            {
                OpacityRectangle.Opacity = customValue;
            }
        }
        private void ActualSizeExample_Loaded(object sender, RoutedEventArgs e)
        {
            // Only create an expression using ActualSize if the API exists to do so.
            if (!(ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)))
            {
                return;
            }

            // We will lay out some buttons in a circle.
            // The formulas we will use are:
            //   X = radius * cos(theta) + xOffset
            //   Y = radius * sin(theta) + yOffset
            //   radius = 1/2 the width and height of the parent container
            //   theta = the angle for each element. The starting value of theta depends on both the number of elements and the relative index of each element.
            //   xOffset = The starting horizontal offset for the element.
            //   yOffset = The starting vertical offset for the element.

            String radius  = "(source.ActualSize.X / 2)";                     // Since the layout is a circle, width and height are equivalent meaning we could use X or Y. We'll use X.
            String theta   = ".02 * " + radius + " + ((2 * Pi)/total)*index"; // The first value is the rate of angular change based on radius. The last value spaces the buttons equally.
            String xOffset = radius;                                          // We offset x by radius because the buttons naturally layout along the left edge. We need to move them to center of the circle first.
            String yOffset = "0";                                             // We don't need to offset y because the buttons naturally layout vertically centered.

            // We combine X, Y, and Z subchannels into a single animation because we can only start a single animation on Translation.
            String expression = String.Format("Vector3({0}*cos({1})+{2}, {0}*sin({1})+{3},0)", radius, theta, xOffset, yOffset);

            int totalElements = 8;

            for (int i = 0; i < totalElements; i++)
            {
                Button element = new Button()
                {
                    Content = "Button"
                };
                AutomationProperties.SetName(element, "Button " + i);

                LayoutPanel.Children.Add(element);

                var anim = _compositor.CreateExpressionAnimation();

                anim.Expression = expression;
                anim.SetScalarParameter("index", i + 1);
                anim.SetScalarParameter("total", totalElements);
                anim.Target = "Translation";
                anim.SetExpressionReferenceParameter("source", LayoutPanel);

                element.StartAnimation(anim);
            }
        }
Exemple #28
0
        private async Task <IWebTokenRequestResultWrapper> AcquireInteractiveWithoutPickerAsync(
            AuthenticationRequestParameters authenticationRequestParameters,
            Prompt prompt,
            IWamPlugin wamPlugin,
            WebAccountProvider provider,
            WebAccount wamAccount)
        {
            bool isForceLoginPrompt = IsForceLoginPrompt(prompt);

            WebTokenRequest webTokenRequest = await wamPlugin.CreateWebTokenRequestAsync(
                provider,
                authenticationRequestParameters,
                isForceLoginPrompt : isForceLoginPrompt,
                isInteractive : true,
                isAccountInWam : true)
                                              .ConfigureAwait(false);

            if (isForceLoginPrompt &&
                ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 6))
            {
                // this feature works correctly since windows RS4, aka 1803 with the AAD plugin only!
                webTokenRequest.Properties["prompt"] = prompt.PromptValue;
            }

            AddCommonParamsToRequest(authenticationRequestParameters, webTokenRequest);

            try
            {
#if WINDOWS_APP
                // UWP requires being on the UI thread
                await _synchronizationContext;
#endif

                var wamResult = await _wamProxy.RequestTokenForWindowAsync(
                    _parentHandle,
                    webTokenRequest,
                    wamAccount).ConfigureAwait(false);

                return(wamResult);
            }
            catch (Exception ex)
            {
                _logger.ErrorPii(ex);
                throw new MsalServiceException(
                          MsalError.WamInteractiveError,
                          "AcquireTokenInteractive without picker failed. See inner exception for details. ", ex);
            }
        }
Exemple #29
0
        private void ToggleFullScreenWhenApplicationViewShowWithStandalone()
        {
            CurrentViewScheduler.Schedule(() =>
            {
                ApplicationView currentView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();

                if (Services.Helpers.DeviceTypeHelper.IsMobile || Services.Helpers.DeviceTypeHelper.IsDesktop)
                {
                    if (NowPlaying)
                    {
                        if (IsPlayerSmallWindowModeEnabled)
                        {
                            if (currentView.IsFullScreenMode)
                            {
                                currentView.ExitFullScreenMode();
                            }
                        }
                        else if (currentView.AdjacentToLeftDisplayEdge && currentView.AdjacentToRightDisplayEdge)
                        {
                            currentView.TryEnterFullScreenMode();
                        }
                    }
                    else
                    {
                        // プレイヤーを閉じた時にCompactOverlayも解除する
                        if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4))
                        {
                            if (currentView.IsViewModeSupported(ApplicationViewMode.CompactOverlay) &&
                                currentView.ViewMode == ApplicationViewMode.CompactOverlay)
                            {
                                _ = currentView.TryEnterViewModeAsync(ApplicationViewMode.Default);
                            }
                        }

                        if (!IsPlayerSmallWindowModeEnabled)
                        {
                            if (IsPlayerShowWithPrimaryView && IsMainView)
                            {
                                if (ApplicationView.PreferredLaunchWindowingMode != ApplicationViewWindowingMode.FullScreen)
                                {
                                    currentView.ExitFullScreenMode();
                                }
                            }
                        }
                    }
                }
            });
        }
Exemple #30
0
        protected async override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
        {
            if (!_isContactsInitialized)
            {
                await InitializeAllAsync();
            }

            bool isPeopleShare = false;

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
            {
                // Make sure the current OS version includes the My People feature before
                // accessing the ShareOperation.Contacts property
                isPeopleShare = (args.ShareOperation.Contacts.Count > 0);
            }

            if (isPeopleShare)
            {
                // Show share UI for MyPeople contact(s)

                Frame      rootFrame          = CreateRootFrame();
                AppContact selectedAppContact = (from c in App.AppContacts where c.ContactId == "1" select c).FirstOrDefault();
                rootFrame.Navigate(typeof(AppContactPanelShell));

                rootFrame.Navigate(typeof(ChatPage), selectedAppContact);

                if (args.ShareOperation.Data.Contains(StandardDataFormats.WebLink))
                {
                    try
                    {
                        Uri sharedWebLink = await args.ShareOperation.Data.GetWebLinkAsync();

                        ((ChatPage)rootFrame.Content).AddChat(args.ShareOperation.Data.Properties.Title);
                        ((ChatPage)rootFrame.Content).AddChat(sharedWebLink.AbsoluteUri);
                    }
                    catch
                    {
                    }
                }


                //AppContact.ChatHistory.Add(ChatTextBox.Text);
            }
            else
            {
                // Show standard share UI for unpinned contacts
            }
        }