Esempio n. 1
0
 /// <summary>
 /// For Windows XAML Phone Applications use a separate app to push items to the Clipboard
 /// </summary>
 /// <param name="text"></param>
 public static void SetText(string text)
 {
     global::Windows.System.LauncherOptions options = new global::Windows.System.LauncherOptions();
     options.PreferredApplicationDisplayName       = "Clipboarder";
     options.PreferredApplicationPackageFamilyName = "InTheHandLtd.Clipboarder";
     options.DisplayApplicationPicker = false;
     global::Windows.System.Launcher.LaunchUriAsync(new Uri(string.Format("clipboard:Set?Text={0}", Uri.EscapeDataString(text))), options);
 }
Esempio n. 2
0
 public static global::Windows.Foundation.IAsyncOperation <global::Windows.System.LaunchUriResult> LaunchUriForResultsForUserAsync(global::Windows.System.User user, global::System.Uri uri, global::Windows.System.LauncherOptions options, global::Windows.Foundation.Collections.ValueSet inputData)
 {
     throw new global::System.NotImplementedException("The member IAsyncOperation<LaunchUriResult> Launcher.LaunchUriForResultsForUserAsync(User user, Uri uri, LauncherOptions options, ValueSet inputData) is not implemented in Uno.");
 }
Esempio n. 3
0
 public static global::Windows.Foundation.IAsyncOperation <global::Windows.System.LaunchUriStatus> LaunchUriForUserAsync(global::Windows.System.User user, global::System.Uri uri, global::Windows.System.LauncherOptions options)
 {
     throw new global::System.NotImplementedException("The member IAsyncOperation<LaunchUriStatus> Launcher.LaunchUriForUserAsync(User user, Uri uri, LauncherOptions options) is not implemented in Uno.");
 }
Esempio n. 4
0
 public static global::Windows.Foundation.IAsyncOperation <bool> LaunchFileAsync(global::Windows.Storage.IStorageFile file, global::Windows.System.LauncherOptions options)
 {
     throw new global::System.NotImplementedException("The member IAsyncOperation<bool> Launcher.LaunchFileAsync(IStorageFile file, LauncherOptions options) is not implemented in Uno.");
 }
        void DoHolding(object sender)
        {
            if (((sender as StackPanel).DataContext as MyRenderItem).Word != -1)
            {
                Flyout ContextFlyout = new Flyout();
                StackPanel Panel = new StackPanel();
                //Panel.SetValue(NameProperty, "TopLevel");
                //Panel.Name = "TopLevel";
                Panel.DataContext = this;
                ContextFlyout.Content = Panel;
                Panel.Children.Add(new ItemsControl() { ItemsPanel = Resources["VirtualPanelTemplate"] as ItemsPanelTemplate, ItemTemplate = Resources["WrapTemplate"] as DataTemplate, ItemsSource = VirtualizingWrapPanelAdapter.GroupRenderModels(System.Linq.Enumerable.Select(AppSettings.ChData.GetMorphologicalDataForWord(((sender as StackPanel).DataContext as MyRenderItem).Chapter, ((sender as StackPanel).DataContext as MyRenderItem).Verse, ((sender as StackPanel).DataContext as MyRenderItem).Word).Items, (Arr) => new MyRenderItem((XMLRender.RenderArray.RenderItem)Arr)).ToList(), UIChanger.MaxWidth) });
                VirtualizingStackPanel.SetVirtualizationMode((Panel.Children.Last() as ItemsControl), VirtualizationMode.Recycling);
                Panel.Children.Add(new Button() { Content = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("CopyToClipboard/Text") });
                (Panel.Children.Last() as Button).Click += (object _sender, RoutedEventArgs _e) =>
                {
#if WINDOWS_APP || WINDOWS_UWP
                    Windows.ApplicationModel.DataTransfer.DataPackage package = new Windows.ApplicationModel.DataTransfer.DataPackage(); package.SetText(((sender as StackPanel).DataContext as MyRenderItem).GetText); Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(package);
#else
                    global::Windows.System.LauncherOptions options = new global::Windows.System.LauncherOptions(); 
                    options.PreferredApplicationDisplayName = "Clipboarder"; 
                    options.PreferredApplicationPackageFamilyName = "InTheHandLtd.Clipboarder"; 
                    options.DisplayApplicationPicker = false; 
                    global::Windows.System.Launcher.LaunchUriAsync(new Uri(string.Format("clipboard:Set?Text={0}", Uri.EscapeDataString(string.Empty))), options); 
#endif
                };
                Panel.Children.Add(new Button() { Content = new TextBlock() { Text = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("Share/Text") } });
                (Panel.Children.Last() as Button).Click += (object _sender, RoutedEventArgs _e) =>
                {
//#if WINDOWS_APP
                Windows.ApplicationModel.DataTransfer.DataPackage package = new Windows.ApplicationModel.DataTransfer.DataPackage();
                    package.SetText(((sender as StackPanel).DataContext as MyRenderItem).GetText);
                    Windows.ApplicationModel.DataTransfer.DataTransferManager.GetForCurrentView().DataRequested += (Windows.ApplicationModel.DataTransfer.DataTransferManager __sender, Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs __e) =>
                    {
                        __e.Request.Data.Properties.Title = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("DisplayName");
                        __e.Request.Data.Properties.Description = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("Description");
                        __e.Request.Data.SetText(((sender as StackPanel).DataContext as MyRenderItem).GetText);
                        Windows.ApplicationModel.DataTransfer.DataTransferManager.GetForCurrentView().DataRequested -= null;
                    };
                    Windows.ApplicationModel.DataTransfer.DataTransferManager.ShowShareUI();
                //#else
                //            Microsoft.Phone.Tasks.ShareStatusTask shareStatusTask = new Microsoft.Phone.Tasks.ShareStatusTask(); 
                //            shareStatusTask.Status = string.Empty;
                //            shareStatusTask.Show(); 
                //#endif
                };
                FlyoutBase.SetAttachedFlyout(sender as StackPanel, ContextFlyout);
                FlyoutBase.ShowAttachedFlyout(sender as StackPanel);
            }
            else if (((sender as StackPanel).DataContext as MyRenderItem).Chapter != -1)
            {
                MenuFlyout ContextFlyout = new MenuFlyout();
                int idxMark = Array.FindIndex(AppSettings.Bookmarks, (Item) => Item[0] == Division && Item[1] == Selection && Item[2] == ((sender as StackPanel).DataContext as MyRenderItem).Chapter && Item[3] == ((sender as StackPanel).DataContext as MyRenderItem).Verse);
                ContextFlyout.Items.Add(new MenuFlyoutItem() { Text = new Windows.ApplicationModel.Resources.ResourceLoader().GetString((idxMark == -1 ? "AddBookmark" : "RemoveBookmark") + "/Text") });
                (ContextFlyout.Items.Last() as MenuFlyoutItem).Click += (object _sender, RoutedEventArgs _e) =>
                {
                    List<int[]> marks = AppSettings.Bookmarks.ToList();
                    if (idxMark != -1) {
                        marks.RemoveAt(idxMark);
                    } else {
                        marks.Add(new int[] { Division, Selection, ((sender as StackPanel).DataContext as MyRenderItem).Chapter, ((sender as StackPanel).DataContext as MyRenderItem).Verse });
                    }
                    AppSettings.Bookmarks = marks.ToArray();
                };
                ContextFlyout.Items.Add(new MenuFlyoutItem() { Text = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("CopyToClipboard/Text") });
                (ContextFlyout.Items.Last() as MenuFlyoutItem).Click += (object _sender, RoutedEventArgs _e) =>
                {
#if WINDOWS_APP || WINDOWS_UWP
                    Windows.ApplicationModel.DataTransfer.DataPackage package = new Windows.ApplicationModel.DataTransfer.DataPackage(); package.SetText(((sender as StackPanel).DataContext as MyRenderItem).GetText); Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(package);
#else
                    global::Windows.System.LauncherOptions options = new global::Windows.System.LauncherOptions(); 
                    options.PreferredApplicationDisplayName = "Clipboarder"; 
                    options.PreferredApplicationPackageFamilyName = "InTheHandLtd.Clipboarder"; 
                    options.DisplayApplicationPicker = false; 
                    global::Windows.System.Launcher.LaunchUriAsync(new Uri(string.Format("clipboard:Set?Text={0}", Uri.EscapeDataString(string.Empty))), options); 
#endif
                };
                ContextFlyout.Items.Add(new MenuFlyoutItem() { Text = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("Share/Text") });
                (ContextFlyout.Items.Last() as MenuFlyoutItem).Click += (object _sender, RoutedEventArgs _e) =>
                {
//#if WINDOWS_APP
                    Windows.ApplicationModel.DataTransfer.DataPackage package = new Windows.ApplicationModel.DataTransfer.DataPackage();
                    package.SetText(((sender as StackPanel).DataContext as MyRenderItem).GetText);
                    Windows.ApplicationModel.DataTransfer.DataTransferManager.GetForCurrentView().DataRequested += (Windows.ApplicationModel.DataTransfer.DataTransferManager __sender, Windows.ApplicationModel.DataTransfer.DataRequestedEventArgs __e) =>
                    {
                        __e.Request.Data.Properties.Title = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("DisplayName");
                        __e.Request.Data.Properties.Description = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("Description");
                        __e.Request.Data.SetText(((sender as StackPanel).DataContext as MyRenderItem).GetText);
                        Windows.ApplicationModel.DataTransfer.DataTransferManager.GetForCurrentView().DataRequested -= null;
                    };
                    Windows.ApplicationModel.DataTransfer.DataTransferManager.ShowShareUI();
//#else
//            Microsoft.Phone.Tasks.ShareStatusTask shareStatusTask = new Microsoft.Phone.Tasks.ShareStatusTask(); 
//            shareStatusTask.Status = string.Empty;
//            shareStatusTask.Show(); 
//#endif
                };
                ContextFlyout.Items.Add(new MenuFlyoutItem() { Text = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("SetPlaybackVerse/Text") });
                (ContextFlyout.Items.Last() as MenuFlyoutItem).Click += (object _sender, RoutedEventArgs _e) =>
                {
                    ViewModel.CurrentVerse = (sender as StackPanel).DataContext as MyRenderItem;
                    for (int count = 0; count <= ViewModel.VerseReferences.Count() - 1; count++)
                    {
                        if (ViewModel.VerseReferences[count] == ViewModel.CurrentVerse) { CurrentPlayingItem = count; break; }
                        VersePlayer.Source = null;
                    }
                };
                //ContextFlyout.Items.Add(new MenuFlyoutItem() { Text = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("ShowExegesis/Text") });
                //(ContextFlyout.Items.Last() as MenuFlyoutItem).Click += (object _sender, RoutedEventArgs _e) => { };
                FlyoutBase.SetAttachedFlyout(sender as StackPanel, ContextFlyout);
                FlyoutBase.ShowAttachedFlyout(sender as StackPanel);
            }
        }
Esempio n. 6
0
 /// <summary>
 /// For Windows XAML Phone Applications use a separate app to push items to the Clipboard
 /// </summary>
 /// <param name="text"></param>
 public static void SetText(string text)
 {
     global::Windows.System.LauncherOptions options = new global::Windows.System.LauncherOptions();
     options.PreferredApplicationDisplayName = "Clipboarder";
     options.PreferredApplicationPackageFamilyName = "InTheHandLtd.Clipboarder";
     options.DisplayApplicationPicker = false;
     global::Windows.System.Launcher.LaunchUriAsync(new Uri(string.Format("clipboard:Set?Text={0}", Uri.EscapeDataString(text))), options);
 }