예제 #1
0
        // Unused and untested 
        public static void ShowMessage(string message, UIElement placementTarget, PlacementMode placementMode=PlacementMode.Top)
        {
            var f = new Callisto.Controls.Flyout();

            var b = new Border()
                           {
                               Width = 300,
                               Height = 125
                           };

            TextBlock tb = new TextBlock();
            tb.HorizontalAlignment = HorizontalAlignment.Center;
            tb.VerticalAlignment = VerticalAlignment.Center;
            tb.TextWrapping = TextWrapping.Wrap;
            tb.FontSize = 12f;
            tb.Text = message;

            b.Child = tb;

            f.Content = b;

            f.Placement = placementMode;
            f.PlacementTarget = placementTarget;

            f.IsOpen = true;
        }
예제 #2
0
        // Unused and untested
        public static void ShowMessage(string message, UIElement placementTarget, PlacementMode placementMode = PlacementMode.Top)
        {
            var f = new Callisto.Controls.Flyout();

            var b = new Border()
            {
                Width  = 300,
                Height = 125
            };

            TextBlock tb = new TextBlock();

            tb.HorizontalAlignment = HorizontalAlignment.Center;
            tb.VerticalAlignment   = VerticalAlignment.Center;
            tb.TextWrapping        = TextWrapping.Wrap;
            tb.FontSize            = 12f;
            tb.Text = message;

            b.Child = tb;

            f.Content = b;

            f.Placement       = placementMode;
            f.PlacementTarget = placementTarget;

            f.IsOpen = true;
        }
예제 #3
0
        /// <summary>
        /// Closes the current internal <seealso cref="Callisto.Settings.Flyout"/> and releases its resources.
        /// </summary>
        protected virtual void DisposeFlyout()
        {
            if (IsOpen)
            {
                // Set the all-important flag
                IsOpen = false;

                // Close the flyout and dispose it
                _flyout.IsOpen  = false;
                _flyout.Content = null;
                _flyout.Dispose();
                _flyout = null;
            }
        }
예제 #4
0
        /// <summary>
        /// Shows a flyout with the current <seealso cref="Content"/>.
        /// </summary>
        /// <param name="target">The object near which to show the flyout.</param>
        /// <param name="placement">The direction from the <paramref name="target"/> to show the flyout.</param>
        /// <param name="maxWidth">The maximum width of the flyout. If null, automatically determines a feasible width.</param>
        public virtual void Show(UIElement target, PlacementMode placement, double?maxWidth)
        {
            lock (__showLock)
            {
                if (__currentOpenFlyout != null)
                {
                    // Must close previous one before opening a new one.
                    __currentOpenFlyout.DisposeFlyout();
                }

                IsOpen = true;

                // Deconnect content
                var contentParent = Content.Parent as Panel;
                if (contentParent != null)
                {
                    contentParent.Children.Remove(Content);
                }

                // Create flyout
                _flyout = new Callisto.Controls.Flyout()
                {
                    Content         = this.Content,
                    PlacementTarget = target,
                    Placement       = placement
                };

                if (maxWidth.HasValue)
                {
                    _flyout.MaxWidth = maxWidth.Value;
                }

                _flyout.Closed += _flyout_Closed;
                _flyout.IsOpen  = true;
            }
        }
예제 #5
0
		public async void MenuItemSelected(ItemClickEventArgs eventArgs)
		{
			var menuItem = (IMenuItem)eventArgs.ClickedItem;
			var popupType = menuItem.PopupType;

			if (menuItem is RunThresholdTestViewModel)
			{
				//int permutations = Int32.Parse(_permutations.Permutations);

				//if (permutations > 0)
				//{
				//	for (int thresh = 100; thresh < 800; thresh += 5)
				//	{
				//		var dtItms = _subjectFilterService.GetDataTypeSettings();

				//		double dThresh = ((double)thresh / (double)100);

				//		List<Threshold> dataTypes = new List<Threshold>();
				//		foreach (var itm in dtItms)
				//		{
				//			if (itm.Value)
				//			{
				//				Threshold t = new Threshold()
				//				{
				//					DataType = itm.Key,
				//					Value = dThresh
				//				};

				//				dataTypes.Add(t);
				//			}
				//		}

				//		// Load the subjects into the compute service
				//		_computeService.LoadSubjects(_regionService.GetNodeCount(), _regionService.GetEdgeCount(), dataTypes, _subjectFilterService.GetGroup1(), _subjectFilterService.GetGroup2());

				//		// Compare groups based on real labels
				//		_computeService.CompareGroups();

				//		// Create our async permutation computation to figure out p values
				//		var permutation = _computeService.PermuteGroupsAsync(permutations);

				//		// Handle progress reporting
				//		permutation.Progress += new Windows.Foundation.AsyncActionProgressHandler<int>((_, p) =>
				//		{
				//			_runThresholdTest.PrimaryValue = p.ToString();
				//		});

				//		// Run the thingy and fix the display when it finishes
				//		await permutation.AsTask();

				//		_runThresholdTest.PrimaryValue = thresh.ToString();
				//		//_eventAggregator.Publish(new PermutationCompleteEvent());

				//		var result = _computeService.GetResults();

				//		Debug.WriteLine("Threshold: " + dThresh.ToString("0.00"));
				//		foreach (var graph in result.Graphs)
				//		{
				//			foreach (var component in graph.Components)
				//			{
				//				if(component.Edges.Count > 0)
				//					Debug.WriteLine("Item: " + graph.Name + " Nodes: " + component.NodeCount.ToString() + " Edges: " + component.Edges.Count.ToString());
				//			}
				//		}
				//	}
				//}
			}
			else if (menuItem is RunExperimentViewModel)
			{
				int permutations = Int32.Parse(_permutations.Permutations);

				if (permutations > 0)
				{
					// Get our active data types
					var dataTypes = _subjectFilterService.GetDataTypeSettings().Where(itm => itm.Value == true).Select(itm => itm.Key).ToList();

					// Load the subjects into the compute service
					_computeService.LoadSubjects(_regionService.GetNodeCount(), _regionService.GetEdgeCount(), dataTypes, _subjectFilterService.GetGroup1(), _subjectFilterService.GetGroup2());

					// Compare groups based on real labels
					_computeService.CompareGroups();

					// Create our async permutation computation to figure out p values
					var permutation = _computeService.PermuteGroupsAsync(permutations);

                    // Handle progress reporting
                    permutation.Progress += new Windows.Foundation.AsyncActionProgressHandler<int>((_, p) =>
                    {
                        _running.PrimaryValue = p.ToString();
                    });

                    try
                    {
                        // Run the thingy and fix the display when it finishes
                        await permutation.AsTask();
                    }
                    catch(Exception ex)
                    {
                        int i = 0;
                    }

					_running.PrimaryValue = permutations.ToString();
					_eventAggregator.Publish(new PermutationCompleteEvent());
				}
			}
			else if (popupType != null)
			{
				var sender = (GridView)eventArgs.OriginalSource;
				var clickedUI = sender.ItemContainerGenerator.ContainerFromItem(eventArgs.ClickedItem);

				var popup = (UserControl)Activator.CreateInstance(popupType);
				popup.DataContext = menuItem;

				// Flyout is a ContentControl so set your content within it.
				Callisto.Controls.Flyout f = new Callisto.Controls.Flyout();
				f.Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.White);
				f.Content = popup;
				f.Placement = PlacementMode.Top;

				if (clickedUI is GridViewItem)
					f.PlacementTarget = clickedUI as UIElement;
				else
					f.PlacementTarget = sender as UIElement;

				f.IsOpen = true;
			}
			else
			{
				if (menuItem.ViewModelType != null)
					_navService.NavigateToViewModel(menuItem.ViewModelType);
			}
		}
예제 #6
0
파일: Flyout.cs 프로젝트: sdao/TuneOut
        /// <summary>
        /// Shows a flyout with the current <seealso cref="Content"/>.
        /// </summary>
        /// <param name="target">The object near which to show the flyout.</param>
        /// <param name="placement">The direction from the <paramref name="target"/> to show the flyout.</param>
        /// <param name="maxWidth">The maximum width of the flyout. If null, automatically determines a feasible width.</param>
        public virtual void Show(UIElement target, PlacementMode placement, double? maxWidth)
        {
            lock (__showLock)
            {
                if (__currentOpenFlyout != null)
                {
                    // Must close previous one before opening a new one.
                    __currentOpenFlyout.DisposeFlyout();
                }

                IsOpen = true;

                // Deconnect content
                var contentParent = Content.Parent as Panel;
                if (contentParent != null)
                {
                    contentParent.Children.Remove(Content);
                }

                // Create flyout
                _flyout = new Callisto.Controls.Flyout()
                {
                    Content = this.Content,
                    PlacementTarget = target,
                    Placement = placement
                };

                if (maxWidth.HasValue)
                {
                    _flyout.MaxWidth = maxWidth.Value;
                }

                _flyout.Closed += _flyout_Closed;
                _flyout.IsOpen = true;
            }
        }
예제 #7
0
파일: Flyout.cs 프로젝트: sdao/TuneOut
        /// <summary>
        /// Closes the current internal <seealso cref="Callisto.Settings.Flyout"/> and releases its resources.
        /// </summary>
        protected virtual void DisposeFlyout()
        {
            if (IsOpen)
            {
                // Set the all-important flag
                IsOpen = false;

                // Close the flyout and dispose it
                _flyout.IsOpen = false;
                _flyout.Content = null;
                _flyout.Dispose();
                _flyout = null;
            }
        }