Inheritance: MonoBehaviour
Esempio n. 1
0
 ///<summary>Inserts one Popup into the database.  Returns the new priKey.</summary>
 internal static long Insert(Popup popup)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         popup.PopupNum=DbHelper.GetNextOracleKey("popup","PopupNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(popup,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     popup.PopupNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(popup,false);
     }
 }
Esempio n. 2
0
 ///<summary>Inserts one Popup into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(Popup popup,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         popup.PopupNum=ReplicationServers.GetKey("popup","PopupNum");
     }
     string command="INSERT INTO popup (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="PopupNum,";
     }
     command+="PatNum,Description,IsDisabled,PopupLevel) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(popup.PopupNum)+",";
     }
     command+=
              POut.Long  (popup.PatNum)+","
         +"'"+POut.String(popup.Description)+"',"
         +    POut.Bool  (popup.IsDisabled)+","
         +    POut.Int   ((int)popup.PopupLevel)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         popup.PopupNum=Db.NonQ(command,true);
     }
     return popup.PopupNum;
 }
        private void wpfMap1_MapClick(object sender, MapClickWpfMapEventArgs e)
        {
            FeatureLayer worldLayer = wpfMap1.FindFeatureLayer("WorldLayer");

            worldLayer.Open();
            Collection<Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(e.WorldLocation, new string[2] { "CNTRY_NAME", "POP_CNTRY" });
            worldLayer.Close();

            if (selectedFeatures.Count > 0)
            {
                StringBuilder info = new StringBuilder();
                info.AppendLine(String.Format(CultureInfo.InvariantCulture, "CNTRY_NAME:\t{0}", selectedFeatures[0].ColumnValues["CNTRY_NAME"]));
                info.AppendLine(String.Format(CultureInfo.InvariantCulture, "POP_CNTRY:\t{0}", double.Parse(selectedFeatures[0].ColumnValues["POP_CNTRY"]).ToString("n0")));
                TBInfo.Text = info.ToString();

                PopupOverlay popupOverlay = (PopupOverlay)wpfMap1.Overlays["PopupOverlay"];
                Popup popup = new Popup(e.WorldLocation);
                popup.Content = info.ToString();
                popup.FontSize = 10d;
                popup.FontFamily = new System.Windows.Media.FontFamily("Verdana");

                popupOverlay.Popups.Clear();
                popupOverlay.Popups.Add(popup);
                popupOverlay.Refresh();
            }
        }
Esempio n. 4
0
    // This function is ran inside of OnGUI()
    // For usage, see http://wiki.unity3d.com/index.php/PopupList#Javascript_-_PopupListUsageExample.js
    public int List(Rect box, GUIContent[] items, GUIStyle boxStyle, GUIStyle listStyle)
    {
        // If the instance's popup selection is visible
        if(isVisible) {

            // Draw a Box
            Rect listRect = new Rect( box.x, box.y + box.height, box.width, box.height * items.Length);
            GUI.Box( listRect, "", boxStyle );

            // Draw a SelectionGrid and listen for user selection
            selectedItemIndex = GUI.SelectionGrid( listRect, selectedItemIndex, items, 1, listStyle );

            // If the user makes a selection, make the popup list disappear
            if(GUI.changed) {
                current = null;
            }
        }

        // Get the control ID
        int controlID = GUIUtility.GetControlID( FocusType.Passive );

        // Listen for controls
        switch( Event.current.GetTypeForControl(controlID) )
        {
            // If mouse button is clicked, set all Popup selections to be retracted
            case EventType.mouseUp:
            {
                current = null;
                break;
            }
        }

        // Draw a button. If the button is clicked
        if(GUI.Button(new Rect(box.x,box.y,box.width,box.height),items[selectedItemIndex])) {

            // If the button was not clicked before, set the current instance to be the active instance
            if(!isClicked) {
                current = this;
                isClicked = true;
            }
            // If the button was clicked before (it was the active instance), reset the isClicked boolean
            else {
                isClicked = false;
            }
        }

        // If the instance is the active instance, set its popup selections to be visible
        if(current == this) {
            isVisible = true;
        }

        // These resets are here to do some cleanup work for OnGUI() updates
        else {
            isVisible = false;
            isClicked = false;
        }

        // Return the selected item's index
        return selectedItemIndex;
    }
Esempio n. 5
0
        public PopupsPage()
        {
            InitializeComponent();
            InitializeHidingAnimationControls();
            InitializePlacementAreaComboBox();
            InitializePopupMenuLongSubMenu();

            _customPopup = new Popup(CustomPopupPanel);
            _customPopup.Child = new CustomPopupChildControl();
            _customPopup.PlacementMode = PopupPlacementMode.AbsoluteOffset;
            _customPopup.HideByClickingOnParentControl = true;

            InitalizePopupMenuSettingsControls();

            _hidingAnimationTime = Popup.HidingAnimationTime;
            _hidingAnimationFramesCount = Popup.HidingAnimationFramesCount;

            HidingAnimationFramesNumericUpDown.ValueChanged += HidingAnimationFramesNumericUpDown_ValueChanged;
            HidingAnimationTimeNumericUpDown.ValueChanged += HidingAnimationTimeNumericUpDown_ValueChanged;

            PlacementAreaComboBox.SelectedIndexChanged += PlacementAreaComboBox_SelectedIndexChanged;
            PlacementModeComboBox.SelectedIndexChanged += PlacementModeComboBox_SelectedIndexChanged;
            MinimumItemHeightNumericUpDown.ValueChanged += MinimumItemHeightNumericUpDown_ValueChanged;
            EnableFixedImageBoxWidthCheckBox.CheckedChanged += EnableFixedImageBoxWidthCheckBox_CheckedChanged;
            FixedImageBoxWidthNumericUpDown.ValueChanged += FixedImageBoxWidthNumericUpDown_ValueChanged;

            AllowAnimationCheckBox.CheckedChanged += AllowAnimationCheckBox_CheckedChanged;
            AllowShadowCheckBox.CheckedChanged += AllowShadowCheckBox_CheckedChanged;
            SamplePopupMenuLongSubMenu.Showing += SamplePopupMenuLongSubMenu_Showing;
        }
        void wpfMap1_MapClick(object sender, MapClickWpfMapEventArgs e)
        {
            FeatureLayer worldLayer = wpfMap1.FindFeatureLayer("RoadLayer");
            InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)wpfMap1.FindFeatureLayer("HighlightLayer");
            Overlay highlightOverlay = wpfMap1.Overlays["HighlightOverlay"];

            // Find the road the user clicked on.
            worldLayer.Open();
            Collection<Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesNearestTo(e.WorldLocation, GeographyUnit.DecimalDegree, 1, new string[1] { "FENAME" });
            worldLayer.Close();

            //Determine the length of the road.
            if (selectedFeatures.Count > 0)
            {
                LineBaseShape lineShape = (LineBaseShape)selectedFeatures[0].GetShape();
                highlightLayer.Open();
                highlightLayer.InternalFeatures.Clear();
                highlightLayer.InternalFeatures.Add(new Feature(lineShape));
                highlightLayer.Close();

                double length = lineShape.GetLength(GeographyUnit.DecimalDegree, DistanceUnit.Meter);
                string lengthMessage = string.Format(CultureInfo.InvariantCulture, "{0} has a length of {1:F2} meters.", selectedFeatures[0].ColumnValues["FENAME"].Trim(), length);

                Popup popup = new Popup(e.WorldLocation);
                popup.Content = lengthMessage;
                PopupOverlay popupOverlay = (PopupOverlay)wpfMap1.Overlays["PopupOverlay"];
                popupOverlay.Popups.Clear();
                popupOverlay.Popups.Add(popup);

                highlightOverlay.Refresh();
                popupOverlay.Refresh();
            }
        }
Esempio n. 7
0
 void Awake()
 {
     if(instance != null){
         Debug.Log("Une instance de Popup est déja présente sur la scène");
         return;
     }
     instance = this;
     okButton.onClick.AddListener(Hide);
 }
Esempio n. 8
0
        public void Child_Control_Should_Appear_In_LogicalChildren()
        {
            var target = new Popup();
            var child = new Control();

            target.Child = child;

            Assert.Equal(new[] { child }, ((ILogical)target).LogicalChildren.ToList());
        }
Esempio n. 9
0
        public void Clearing_Child_Should_Remove_From_LogicalChildren()
        {
            var target = new Popup();
            var child = new Control();

            target.Child = child;
            target.Child = null;

            Assert.Equal(new ILogical[0], ((ILogical)target).LogicalChildren.ToList());
        }
Esempio n. 10
0
        public NavigationExample()
        {
            var btnNavigate = new Button {Text = "Navigate to another Page"};
            var btnPopup = new Button {Text = "Show Popup"};

            _popup = new Popup
            {
                XPositionRequest = 0.5,
                YPositionRequest = 0.2,
                ContentHeightRequest = 0.1,
                ContentWidthRequest = 0.4,
                Padding = 10,

                Body = new ContentView
                {
                    BackgroundColor = Color.White,
                    Content = new Label
                    {
                        VerticalTextAlignment = TextAlignment.Center,
                        HorizontalTextAlignment = TextAlignment.Center,
                        TextColor = Color.Black,
                        Text = "Hello, World!"
                    }
                }
            };

            // Initialize event handlers
            btnPopup.Clicked += BtnPopup_Clicked;
            btnNavigate.Clicked += BtnNavigate_Clicked;
            _popup.Tapped += Popup_Tapped;

            // Notice _popup is not added to this ContentPage
            Content = new StackLayout
            {
                Padding = 15,

                Children =
                {
                    btnNavigate,
                    btnPopup
                }
            };

            // Initialize popup view
            var _ = new PopupPageInitializer(this) { _popup };

            // Child page that will opened via btnPopup.Clicked
            _childPage = new ContentPage
            {
                Content = new Label
                {
                    Text = "Hello, World!"
                }
            };
        }
Esempio n. 11
0
        public void Clearing_Child_Should_Clear_Child_Controls_Parent()
        {
            var target = new Popup();
            var child = new Control();

            target.Child = child;
            target.Child = null;

            Assert.Null(child.Parent);
            Assert.Null(((ILogical)child).LogicalParent);
        }
Esempio n. 12
0
    public Popup()
        : base()
    {
        Name = "Popup";

        textbox = "";
        instance = this;
        timeout = 0.0f;

        visible = false;
        hasCancel = true;
    }
Esempio n. 13
0
	// Use this for initialization
	void Start () 
	{
		instance = this;

		yes = transform.FindChild ("Yes").gameObject;
		no = transform.FindChild ("No").gameObject;
		ok = transform.FindChild ("Ok").gameObject;
		video = transform.FindChild ("Video").gameObject;
		descricao = transform.FindChild ("Descricao").GetComponent<UILabel>();

		Hide ();
	}
Esempio n. 14
0
    void Start()
    {
        style = new GUIStyle();
          style.normal.background = Resources.Load("Textures/SyntaxHighlightRed") as Texture2D;
          style.normal.textColor = Color.white;
          style.alignment = TextAnchor.MiddleCenter;
          style.fontSize = 20;
          style.normal.textColor = Color.white;
          style.font = Resources.Load("Erika Ormig") as Font;

          mainPopup = this;
    }
Esempio n. 15
0
 public void Close()
 {
     playerController.enabled = true;
     Cursor.visible = false;
     Cursor.lockState = CursorLockMode.Locked;
     if (current == null) {
         return;
     }
     current.gameObject.SetActive(false);
     current = null;
     onClose();
 }
Esempio n. 16
0
        public CodedSimpleExample()
        {
            var popup = new Popup
            {
                XPositionRequest = 0.5,
                YPositionRequest = 0.5,
                ContentHeightRequest = 0.8,
                ContentWidthRequest = 0.8,
                Padding = 10,
                Body = new ContentView
                {
                    BackgroundColor = Color.White,
                    Content = new StackLayout
                    {
                        Children =
                        {
                            new Entry(),
                            new Label
                            {
                                VerticalTextAlignment = TextAlignment.Center,
                                HorizontalTextAlignment = TextAlignment.Center,
                                TextColor = Color.Black,
                                Text = "Hello, World!"
                            }
                        }
                    }
                }
            };

            popup.Tapped += (sender, args) =>
            {
                args.Popup.Hide();
            };

            var button = new Button { Text = "Show Popup" };
            button.Clicked += (s, e) => popup.Show();

            var stack = new StackLayout
            {
                Children =
                {
                    new Entry { Text = "Some input..."},
                    button
                }
            };

            Device.OnPlatform(() => stack.Padding = new Thickness(0, 25, 0, 0));
            Content = stack;
            new PopupPageInitializer(this) { popup };
        }
Esempio n. 17
0
        public void Clearing_Child_Should_Fire_LogicalChildren_CollectionChanged()
        {
            var target = new Popup();
            var child = new Control();
            var called = false;

            target.Child = child;

            ((ILogical)target).LogicalChildren.CollectionChanged += (s, e) =>
                called = e.Action == NotifyCollectionChangedAction.Remove;

            target.Child = null;

            Assert.True(called);
        }
Esempio n. 18
0
 public void Open()
 {
     if (isOpen()) {
         return;
     }
     playerController.enabled = false;
     Cursor.visible = true;
     Cursor.lockState = CursorLockMode.None;
     if (current != null) {
         current.Close();
     }
     current = this;
     current.gameObject.SetActive(true);
     onOpen();
 }
Esempio n. 19
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<Popup> TableToList(DataTable table){
			List<Popup> retVal=new List<Popup>();
			Popup popup;
			for(int i=0;i<table.Rows.Count;i++) {
				popup=new Popup();
				popup.PopupNum       = PIn.Long  (table.Rows[i]["PopupNum"].ToString());
				popup.PatNum         = PIn.Long  (table.Rows[i]["PatNum"].ToString());
				popup.Description    = PIn.String(table.Rows[i]["Description"].ToString());
				popup.IsDisabled     = PIn.Bool  (table.Rows[i]["IsDisabled"].ToString());
				popup.PopupLevel     = (EnumPopupLevel)PIn.Int(table.Rows[i]["PopupLevel"].ToString());
				popup.UserNum        = PIn.Long  (table.Rows[i]["UserNum"].ToString());
				popup.DateTimeEntry  = PIn.DateT (table.Rows[i]["DateTimeEntry"].ToString());
				popup.IsArchived     = PIn.Bool  (table.Rows[i]["IsArchived"].ToString());
				popup.PopupNumArchive= PIn.Long  (table.Rows[i]["PopupNumArchive"].ToString());
				retVal.Add(popup);
			}
			return retVal;
		}
        partial void InitializeBusyIndicator()
        {
            if (_busyIndicator != null)
            {
                return;
            }

            _grid = new Grid();
            _grid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)});
            _grid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)});
            _grid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)});
            _grid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(1, GridUnitType.Star)});

            var backgroundBorder = new Border();
            backgroundBorder.Background = new SolidColorBrush(Colors.Gray);
            backgroundBorder.Opacity = 0.5;
            backgroundBorder.SetValue(Grid.RowSpanProperty, 4);
            _grid.Children.Add(backgroundBorder);

            _statusTextBlock = new TextBlock();
            //_statusTextBlock.Style = (Style)Application.Current.Resources["PhoneTextNormalStyle"];
            _statusTextBlock.HorizontalAlignment = HorizontalAlignment.Center;
            _statusTextBlock.SetValue(Grid.RowProperty, 1);
            _grid.Children.Add(_statusTextBlock);

            _busyIndicator = ConstructorBusyIndicator();
            _busyIndicator.SetValue(Grid.RowProperty, 2);
            _grid.Children.Add(_busyIndicator);

            _containerPopup = new Popup();
            _containerPopup.VerticalAlignment = VerticalAlignment.Center;
            _containerPopup.HorizontalAlignment = HorizontalAlignment.Center;
            _containerPopup.Child = _grid;

            double rootWidth = Window.Current.Bounds.Width;
            double rootHeight = Window.Current.Bounds.Height;

            _busyIndicator.Width = rootWidth;

            _grid.Width = rootWidth;
            _grid.Height = rootHeight;

            _containerPopup.UpdateLayout();
        }
    public void Configure(string message, Popup parent, float parentBottom, float duration = 5)
    {
        Parent = parent;
        Text text = transform.Find("Text").GetComponent<Text>();
        text.text = message;
        MaxLife = duration;

        ParentBottom = parentBottom;
        Height = text.preferredHeight + Border * 2f;
        RectTransformExtensions.SetHeight(((RectTransform)transform), Height);

        float lastPopupBottom = ParentBottom;
        if (parent.Popups.Count > 0) {
            GameObject lastPopup = parent.Popups[parent.Popups.Count - 1];
            RectTransform rectTrans = (RectTransform)lastPopup.transform;
            lastPopupBottom = rectTrans.localPosition.y - rectTrans.rect.height / 2f;
        }

        BoxCollider2D collider = this.GetComponent<BoxCollider2D>();
        collider.size = new Vector3(collider.size.x, Height + Border);
        transform.localPosition = new Vector3(0, lastPopupBottom - (Height + Border * 5f) / 2f, 0);

        //return transform.localPosition.y - Height / 2f;
    }
        private void wpfMap1_MapClick(object sender, MapClickWpfMapEventArgs e)
        {
            FeatureLayer worldLayer = wpfMap1.FindFeatureLayer("WorldLayer");

            // Find the country the user clicked on.
            worldLayer.Open();
            Collection<Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesContaining(e.WorldLocation, new string[1] { "CNTRY_NAME" });
            worldLayer.Close();

            // Determine the area of the country.
            if (selectedFeatures.Count > 0)
            {
                AreaBaseShape areaShape = (AreaBaseShape)selectedFeatures[0].GetShape();
                double area = areaShape.GetArea(GeographyUnit.DecimalDegree, AreaUnit.SquareKilometers);
                string areaMessage = string.Format(CultureInfo.InvariantCulture, "{0} has an area of \r{1:N0} square kilometers.", selectedFeatures[0].ColumnValues["CNTRY_NAME"].Trim(), area);

                Popup popup = new Popup(e.WorldLocation);
                popup.Content = areaMessage;
                PopupOverlay popupOverlay = (PopupOverlay)wpfMap1.Overlays["PopupOverlay"];
                popupOverlay.Popups.Clear();
                popupOverlay.Popups.Add(popup);
                popupOverlay.Refresh();
            }
        }
        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeographyUnit.DecimalDegree;

            WorldMapKitWmsWpfOverlay worldOverlay = new WorldMapKitWmsWpfOverlay();
            Map1.Overlays.Add(worldOverlay);

            PopupOverlay popupOverlay = new PopupOverlay();
            Map1.Overlays.Add(popupOverlay);

            ShapeFileFeatureLayer majorCitiesShapeLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\MajorCities.shp");
            majorCitiesShapeLayer.Open();
            Collection<Feature> features = majorCitiesShapeLayer.QueryTools.GetAllFeatures(ReturningColumnsType.AllColumns);
            foreach (Feature feature in features)
            {
                Popup popup = new Popup(feature.GetShape().GetCenterPoint());
                popup.Content = feature.ColumnValues["AREANAME"];
                popupOverlay.Popups.Add(popup);
            }
            majorCitiesShapeLayer.Close();

            Map1.CurrentExtent = popupOverlay.GetBoundingBox();
            Map1.Refresh();
        }
Esempio n. 24
0
 public static void Hide(this Popup popup, UIElement newContent)
 {
     SetContent(popup, newContent);
     Hide(popup);
 }
Esempio n. 25
0
        /// <summary>
        /// Builds the visual tree for the DatePicker control when a new template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            if (_popUp != null)
            {
                _popUp.RemoveHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PopUp_PreviewMouseLeftButtonDown));
                _popUp.Opened -= PopUp_Opened;
                _popUp.Closed -= PopUp_Closed;
                _popUp.Child   = null;
            }

            if (_dropDownButton != null)
            {
                _dropDownButton.Click -= DropDownButton_Click;
                _dropDownButton.RemoveHandler(MouseLeaveEvent, new MouseEventHandler(DropDownButton_MouseLeave));
            }

            if (_textBox != null)
            {
                _textBox.RemoveHandler(TextBox.KeyDownEvent, new KeyEventHandler(TextBox_KeyDown));
                _textBox.RemoveHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(TextBox_TextChanged));
                _textBox.RemoveHandler(TextBox.LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus));
            }

            base.OnApplyTemplate();

            _popUp = GetTemplateChild(ElementPopup) as Popup;

            if (_popUp != null)
            {
                _popUp.AddHandler(PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(PopUp_PreviewMouseLeftButtonDown));
                _popUp.Opened += PopUp_Opened;
                _popUp.Closed += PopUp_Closed;
                _popUp.Child   = this._calendar;

                if (this.IsDropDownOpen)
                {
                    this._popUp.IsOpen = true;
                }
            }

            _dropDownButton = GetTemplateChild(ElementButton) as Button;
            if (_dropDownButton != null)
            {
                _dropDownButton.Click += DropDownButton_Click;
                _dropDownButton.AddHandler(MouseLeaveEvent, new MouseEventHandler(DropDownButton_MouseLeave), true);

                // If the user does not provide a Content value in template, we provide a helper text that can be used in Accessibility
                // this text is not shown on the UI, just used for Accessibility purposes
                if (_dropDownButton.Content == null)
                {
                    _dropDownButton.Content = SR.Get(SRID.DatePicker_DropDownButtonName);
                }
            }

            _textBox = GetTemplateChild(ElementTextBox) as DatePickerTextBox;

            if (this.SelectedDate == null)
            {
                SetWaterMarkText();
            }

            if (_textBox != null)
            {
                _textBox.AddHandler(TextBox.KeyDownEvent, new KeyEventHandler(TextBox_KeyDown), true);
                _textBox.AddHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(TextBox_TextChanged), true);
                _textBox.AddHandler(TextBox.LostFocusEvent, new RoutedEventHandler(TextBox_LostFocus), true);

                if (this.SelectedDate == null)
                {
                    if (!string.IsNullOrEmpty(this._defaultText))
                    {
                        _textBox.Text = this._defaultText;
                        SetSelectedDate();
                    }
                }
                else
                {
                    _textBox.Text = this.DateTimeToString((DateTime)this.SelectedDate);
                }
            }
        }
        private void StartPreviewDragging(Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            _isDraggingPreview = true;
            _previewPopup      = new Popup
            {
                Width  = _parentGrid.ActualWidth,
                Height = _parentGrid.ActualHeight
            };

            _previewPopup.IsOpen  = true;
            _previewPopupHostGrid = new Grid
            {
                VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Stretch,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch
            };

            _parentGrid.Children.Add(_previewPopupHostGrid);
            if (_parentGrid.RowDefinitions.Count > 0)
            {
                Grid.SetRowSpan(_previewPopupHostGrid, _parentGrid.RowDefinitions.Count);
            }
            if (_parentGrid.ColumnDefinitions.Count > 0)
            {
                Grid.SetColumnSpan(_previewPopupHostGrid, _parentGrid.ColumnDefinitions.Count);
            }
            _previewPopupHostGrid.Children.Add(_previewPopup);

            _previewGrid = new Grid
            {
                Width  = _parentGrid.ActualWidth,
                Height = _parentGrid.ActualHeight
            };

            _previewPopup.Child = _previewGrid;

            foreach (var definition in _parentGrid.RowDefinitions)
            {
                var definitionCopy = new RowDefinition
                {
                    Height    = definition.Height,
                    MaxHeight = definition.MaxHeight,
                    MinHeight = definition.MinHeight
                };

                _previewGrid.RowDefinitions.Add(definitionCopy);
            }

            foreach (var definition in _parentGrid.ColumnDefinitions)
            {
                var w   = definition.Width;
                var mxw = definition.MaxWidth;
                var mnw = definition.MinWidth;

                var definitionCopy = new ColumnDefinition();

                definitionCopy.Width = w;
                definition.MinWidth  = mnw;
                if (!double.IsInfinity(definition.MaxWidth))
                {
                    definition.MaxWidth = mxw;
                }
                //{
                //    Width = definition.Width,
                //    MaxWidth = definition.MaxWidth,
                //    MinWidth = definition.MinWidth
                //};

                _previewGrid.ColumnDefinitions.Add(definitionCopy);
            }

            _previewGridSplitter = new CustomGridSplitter
            {
                Opacity             = 0.0,
                ShowsPreview        = false,
                Width               = this.Width,
                Height              = this.Height,
                Margin              = this.Margin,
                VerticalAlignment   = this.VerticalAlignment,
                HorizontalAlignment = this.HorizontalAlignment,
                ResizeBehavior      = this.ResizeBehavior,
                ResizeDirection     = this.ResizeDirection,
                KeyboardIncrement   = this.KeyboardIncrement
            };

            Grid.SetColumn(_previewGridSplitter, Grid.GetColumn(this));
            var cs = Grid.GetColumnSpan(this);

            if (cs > 0)
            {
                Grid.SetColumnSpan(_previewGridSplitter, cs);
            }
            Grid.SetRow(_previewGridSplitter, Grid.GetRow(this));
            var rs = Grid.GetRowSpan(this);

            if (rs > 0)
            {
                Grid.SetRowSpan(_previewGridSplitter, rs);
            }
            _previewGrid.Children.Add(_previewGridSplitter);

            _previewControlBorder = new Border
            {
                Width               = this.Width,
                Height              = this.Height,
                Margin              = this.Margin,
                VerticalAlignment   = this.VerticalAlignment,
                HorizontalAlignment = this.HorizontalAlignment,
            };

            Grid.SetColumn(_previewControlBorder, Grid.GetColumn(this));
            if (cs > 0)
            {
                Grid.SetColumnSpan(_previewControlBorder, cs);
            }
            Grid.SetRow(_previewControlBorder, Grid.GetRow(this));
            if (rs > 0)
            {
                Grid.SetRowSpan(_previewControlBorder, rs);
            }
            _previewGrid.Children.Add(_previewControlBorder);

            _previewControl = new GridSplitterPreviewControl();
            if (this.PreviewStyle != null)
            {
                _previewControl.Style = this.PreviewStyle;
            }
            _previewControlBorder.Child = _previewControl;

            _previewPopup.Child = _previewGrid;
            //await this.previewGridSplitter.WaitForLoadedAsync();

            //this.previewGridSplitter.OnPointerPressed(e);
            _previewGridSplitter._dragPointer = e.Pointer.PointerId;
            _previewGridSplitter._effectiveResizeDirection = this.DetermineEffectiveResizeDirection();
            _previewGridSplitter._parentGrid   = _previewGrid;
            _previewGridSplitter._lastPosition = e.GetCurrentPoint(_previewGrid).Position;
            _previewGridSplitter._isDragging   = true;
            _previewGridSplitter.StartDirectDragging(e);
            _previewGridSplitter.DraggingCompleted += PreviewGridSplitter_DraggingCompleted;
        }
Esempio n. 27
0
 public static void SetTitleColor(this Popup popup, EColor color)
 {
     popup.SetPartColor(Device.Idiom == TargetIdiom.TV ? ThemeConstants.Popup.ColorClass.TV.Title : ThemeConstants.Popup.ColorClass.Title, color);
 }
 private static void HidePopup()
 {
     popup.IsOpen = false;
     popup        = null;
 }
 /// <summary>
 /// Displays a poup and returns a result.
 /// </summary>
 /// <typeparam name="T">
 /// The <see cref="T"/> result that is returned when the popup is dismissed.
 /// </typeparam>
 /// <param name="element">
 /// The current <see cref="NavigableElement"/> that has a valid <see cref="INavigation"/>.
 /// </param>
 /// <param name="popup">
 /// The <see cref="Popup{T}"/> to display.
 /// </param>
 /// <returns>
 /// A task that will complete once the <see cref="Popup{T}"/> is dismissed.
 /// </returns>
 public static Task <T?> ShowPopupAsync <T>(this NavigableElement element, Popup <T?> popup) =>
 element.Navigation.ShowPopupAsync(popup);
Esempio n. 30
0
 public static void SetContentBackgroundColor(this Popup popup, EColor color)
 {
     popup.SetPartColor(ThemeConstants.Popup.ColorClass.ContentBackground, color);
 }
Esempio n. 31
0
        /// <summary>
        /// Initialize and invoke the login dialog
        /// </summary>
        /// <param name="clientId">The client id of the application.</param>
        /// <param name="scopes">The scopes that the application needs user consent for.</param>
        /// <param name="silent">True if authentication should be done w/ no UI.</param>
        /// <param name="callback">The callback function to be invoked when login completes.</param>
        public void AuthenticateAsync(string clientId, string scopes, bool silent, Action <string, Exception> callback)
        {
            this.callback = callback;

            if (silent)
            {
                // Silent flow not supported on phone.
                if (callback != null)
                {
                    ThreadPool.QueueUserWorkItem(
                        (object state) =>
                    {
                        callback(GenerateUserUnknownResponse(this.liveAuthClient.RedirectUrl), null);
                    });
                }

                return;
            }

            if (this.popup != null)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("LoginPopupAlreadyOpen"));
            }

            string consentUrl = this.liveAuthClient.BuildLoginUrl(scopes, false);

            var rootVisual = Application.Current.RootVisual as PhoneApplicationFrame;

            Debug.Assert(rootVisual != null);

            if (rootVisual.RenderSize.Height <= 0)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("RootVisualNotRendered"));
            }

            // Store the application bar and remove from the page so it doesn't interfere with the popup login page.
            // It is restored when the popup closes.
            this.rootPage = rootVisual.Content as PhoneApplicationPage;
            if (this.rootPage != null)
            {
                this.appBar = rootPage.ApplicationBar;
                this.rootPage.ApplicationBar = null;
            }

            var loginPage = new LoginPage(consentUrl, this.liveAuthClient.RedirectUrl, this.OnLoginPageCompleted);

            int offset = 0;

            if (SystemTray.IsVisible)
            {
                offset = PhoneAuthClient.RenderSizeOffset;
            }
            offset     = (rootVisual.RenderSize.Height >= offset) ? offset : 0;
            this.popup = new Popup()
            {
                Child          = loginPage,
                VerticalOffset = offset,
                Height         = Application.Current.RootVisual.RenderSize.Height - offset,
                IsOpen         = true
            };
        }
Esempio n. 32
0
        /// <summary>
        /// Creates a popup for hosting a popup window.
        /// </summary>
        /// <param name="rootModel">The model.</param>
        /// <param name="settings">The optional popup settings.</param>
        /// <returns>The popup.</returns>
        protected virtual Popup CreatePopup(object rootModel, IDictionary<string, object> settings)
        {
            var popup = new Popup();

            if (this.ApplySettings(popup, settings))
            {
                if (!settings.ContainsKey("PlacementTarget") && !settings.ContainsKey("Placement"))
                {
                    popup.Placement = PlacementMode.MousePoint;
                }

                if (!settings.ContainsKey("AllowsTransparency"))
                {
                    popup.AllowsTransparency = true;
                }
            }
            else
            {
                popup.AllowsTransparency = true;
                popup.Placement = PlacementMode.MousePoint;
            }

            return popup;
        }
Esempio n. 33
0
        /// <summary>
        /// Called when the MenuItem's template has been applied.
        /// </summary>
        protected override void OnTemplateApplied()
        {
            base.OnTemplateApplied();

            this.popup = this.GetTemplateChild<Popup>("popup");
            this.popup.DependencyResolver = DependencyResolver.Instance;
            this.popup.PopupRootCreated += this.PopupRootCreated;
            this.popup.Opened += this.PopupOpened;
            this.popup.Closed += this.PopupClosed;
        }
        private void btnShowDish_Click(object sender, EventArgs e)
        {
            var dishesTyep = chbShowDishType.SelectedItem as DishesTyep;
            if (dishesTyep == null)
            {
                return;
            }

            var showDishListControl = new ShowDishListControl(dishesTyep.DishesList);
            var pop = new Popup(showDishListControl);
            pop.Show(btnShowDish, false);
        }
Esempio n. 35
0
 public static bool SetTitleTextPart(this Popup popup, string title)
 {
     return(popup.SetPartText(ThemeConstants.Popup.Parts.Title, title));
 }
Esempio n. 36
0
        public static void closeOthersButNot(Popup current)
        {
            var others = annoyed.Where(p => p.IsOpen && !ReferenceEquals(current, p)).ToList();

            Task.Factory.StartNew(() => others.ToList().ForEach(p => p.Dispatcher.Invoke(() => { p.IsOpen = false; })));
        }
Esempio n. 37
0
        private void TruncateToBoundsVertical(

#if NETFX_CORE
            Popup parent
Esempio n. 38
0
        public void Play()
        {
            ClickableToRemove = new List <IClickable>();
            int            leftOffset   = 10;
            int            topOffset    = 10;
            int            buttonWidth  = 200;
            int            buttonHeight = 50;
            int            topOrigin    = (int)(Game1.self.graphics.PreferredBackBufferHeight * 0.3);
            int            leftOrigin   = (int)(Game1.self.graphics.PreferredBackBufferWidth * 0.5 - (buttonWidth + 10));
            Point          popupOrigin  = new Point(leftOrigin, topOrigin);
            RelativeLayout layout       = new RelativeLayout();

            up = new Button(buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                text = "up"
            };
            up.Origin      = new Point(leftOrigin + leftOffset, topOrigin + topOffset);
            up.clickEvent += upClick;

            Clickable.Add(up);
            ClickableToRemove.Add(up);
            down = new Button(buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                text = "down"
            };
            exit = new Button(buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                text = "exit"
            };
            search = new Button(buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                text = "search game"
            };
            search.ActiveChangeable = false;
            search.clickEvent      += searchClick;
            Clickable.Add(search);
            ClickableToRemove.Add(search);
            exit.clickEvent += exitClick;
            Clickable.Add(exit);
            ClickableToRemove.Add(exit);
            down.clickEvent += downClick;
            Clickable.Add(down);
            ClickableToRemove.Add(down);
            g                = new Grid(1, 8, buttonWidth, buttonHeight);
            g.Origin         = new Point(leftOrigin + leftOffset, up.Origin.Y + up.Height + 10);
            g.AllVisible     = false;
            g.MaxChildren    = true;
            g.ChildMaxAmount = 8;
            g.VisibleRows    = 5;
            Game1.self.Decks.Where(a => a.Ships.Count > 0).ToList().ForEach(p =>
            {
                Deck d = new Deck(new Point(), buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true, p.Name);
                d.SetFleet(p);
                d.clickEvent      += DeckClick;
                d.ActiveChangeable = true;
                Clickable.Add(d);
                ClickableToRemove.Add(d);
                g.AddChild(d);
            });

            g.WitdhAndHeightColumnDependant = false;
            g.ConstantRowsAndColumns        = true;
            g.UpdateP();
            Point downPoint = new Point(leftOrigin + leftOffset, g.Origin.Y + (int)g.RowOffset(5) + 10);

            down.Origin       = downPoint;
            exit.Origin       = new Point(down.Origin.X + 10 + buttonWidth, down.Origin.Y);
            search.Origin     = new Point(exit.Origin.X, exit.Origin.Y - buttonHeight - 10);
            labelWaiting      = new Label(buttonWidth, buttonHeight * 2, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true);
            labelWaiting.Text = initialText;
            time = 0;
            labelWaiting.Origin = new Point(up.Origin.X + buttonWidth + 10, up.Origin.Y);
            layout.AddChild(up);
            layout.AddChild(down);
            layout.AddChild(g);
            layout.AddChild(exit);
            layout.AddChild(search);
            layout.AddChild(labelWaiting);
            popup        = new Popup(popupOrigin, 2 * buttonWidth + 30, topOffset + up.Height + (int)g.RowOffset(5) + 10 + down.Height + 10 + 10, Game1.self.GraphicsDevice, Gui);
            popup.layout = layout;
            up.Update();
            down.Update();
            exit.Update();
            search.Update();
            g.UpdateP();
            labelWaiting.Update();
            popup.SetBackground();
            Game1.self.popupToDraw = popup;
            SetClickables(false);
            popup.SetActive(true);
            popup.layout.UpdateActive(true);
            search.Active = false;
        }
 private void CtrlContentPage_SizeChanged(object sender, EventArgs e)
 {
     Popup.HideCurrentContextMenu();
     Popup.UpdateActivityIndicators();
 }
Esempio n. 40
0
        public void PlayCustom()
        {
            int topOrigin    = (int)(Game1.self.graphics.PreferredBackBufferHeight * 0.2);
            int buttonWidth  = 200;
            int leftOffset   = 10;
            int leftOrigin   = (int)(Game1.self.graphics.PreferredBackBufferWidth * 0.5 - (2 * buttonWidth + leftOffset * 1.5));
            int topOffset    = 10;
            int buttonHeight = 50;

            ClickableToRemove = new List <IClickable>();
            RelativeLayout layout = new RelativeLayout();

            nameInputBox = new InputBox(new Point(leftOrigin + leftOffset, topOrigin + topOffset), 2 * buttonWidth, 2 * buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                TextLimit = 30,
                BasicText = "Room name"
            };
            creatornameInputBox = new InputBox(new Point(leftOrigin + leftOffset, nameInputBox.Origin.Y + nameInputBox.Height + topOffset), 2 * buttonWidth, 2 * buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                TextLimit = 30,
                BasicText = "Creator name"
            };
            Clickable.Add(nameInputBox);
            ClickableToRemove.Add(nameInputBox);
            Clickable.Add(creatornameInputBox);
            ClickableToRemove.Add(creatornameInputBox);
            Join = new Button(new Point(nameInputBox.Origin.X, creatornameInputBox.Origin.Y + creatornameInputBox.Height + topOffset), buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                Text = "Join"
            };
            Join.clickEvent += onJoin;
            Clickable.Add(Join);
            ClickableToRemove.Add(Join);
            Create = new Button(new Point(Join.Origin.X + buttonWidth, Join.Origin.Y), buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                Text = "Create"
            };
            Create.clickEvent += onCreate;
            Clickable.Add(Create);
            ClickableToRemove.Add(Create);
            labelError = new Label(new Point(nameInputBox.Origin.X + nameInputBox.Width + leftOffset, nameInputBox.Origin.Y), buttonWidth * 2, buttonHeight * 3, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                Text = "To create room write the name and click Create button, to join room write it's name and click Join button." +
                       " To join you have also to write creator's name."
            };
            Button Exit = new Button(new Point(labelError.Origin.X, labelError.Origin.Y + labelError.Height + topOffset), buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                Text = "Exit"
            };

            Exit.clickEvent += onExitCustom;
            Clickable.Add(Exit);
            ClickableToRemove.Add(Exit);

            up = new Button(buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                text = "up"
            };
            up.Origin      = new Point(nameInputBox.Origin.X, Join.Origin.Y + Join.Height + topOffset);
            up.clickEvent += upClick;

            Clickable.Add(up);
            ClickableToRemove.Add(up);

            down = new Button(buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true)
            {
                text = "down"
            };
            down.clickEvent += downClick;
            Clickable.Add(down);
            ClickableToRemove.Add(down);


            g                = new Grid(1, 8, buttonWidth, buttonHeight);
            g.Origin         = new Point(Join.Origin.X, up.Origin.Y + up.Height + topOffset);
            g.AllVisible     = false;
            g.MaxChildren    = true;
            g.ChildMaxAmount = 8;
            g.VisibleRows    = 5;
            Game1.self.Decks.ForEach(p =>
            {
                Deck d = new Deck(new Point(0, 0), buttonWidth, buttonHeight, Game1.self.GraphicsDevice, Gui, Gui.mediumFont, true, p.Name);
                d.SetFleet(p);
                d.clickEvent      += DeckClick;
                d.ActiveChangeable = true;
                Clickable.Add(d);
                ClickableToRemove.Add(d);
                g.AddChild(d);
            });

            g.WitdhAndHeightColumnDependant = false;
            g.ConstantRowsAndColumns        = true;
            g.UpdateP();
            ;
            Point downPoint = new Point(leftOrigin + leftOffset, g.Origin.Y + (int)g.RowOffset(5) + 10);

            down.Origin = downPoint;
            Exit.Origin = new Point(Exit.Origin.X, down.Origin.Y);


            layout.AddChild(creatornameInputBox);
            layout.AddChild(nameInputBox);
            layout.AddChild(Join);
            layout.AddChild(Create);
            layout.AddChild(labelError);
            layout.AddChild(Exit);
            layout.AddChild(g);
            layout.AddChild(up);
            layout.AddChild(down);
            popup        = new Popup(new Point(leftOrigin, topOrigin), 4 * buttonWidth + leftOffset * 3, 7 * buttonHeight + topOffset * 7 + (int)g.RowOffset(5), Game1.self.GraphicsDevice, Gui);
            popup.layout = layout;

            nameInputBox.Update();
            creatornameInputBox.Update();
            g.UpdateP();
            Join.Update();
            Create.Update();
            labelError.Update();
            Exit.Update();
            up.Update();
            down.Update();
            ;
            popup.SetBackground();
            Game1.self.popupToDraw = popup;
            SetClickables(false);
            popup.SetActive(true);
            popup.layout.UpdateActive(true);
            Join.Active   = false;
            Create.Active = false;
        }
Esempio n. 41
0
        public override bool FireEvent(Event E)
        {
            //...
            if (E.ID == "Regenerating" && ParentObject.HasEffect("Submerged"))
            {
                int RegenerationAmountParameter = E.GetIntParameter("Amount");
                RegenerationAmountParameter += (int)Math.Ceiling((float)RegenerationAmountParameter);
                E.SetParameter("Amount", RegenerationAmountParameter);
            }
            else if (E.ID == "BeginMove" && ParentObject.HasEffect("Submerged"))
            {
                Cell Cell = E.GetParameter("DestinationCell") as Cell;
                if (((!Cell.HasObjectWithPart("LiquidVolume") || (Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200) && ParentObject.IsPlayer() && ParentObject.HasEffect("Submerged")))
                {
                    if (Popup.ShowYesNo("Surface and go ashore?") == (int)DialogResult.Yes)
                    {
                        ParentObject.Splash("{{b|*}}");
                        ParentObject.RemoveEffect("Submerged");
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            else if (E.ID == "DiveCommand")
            {
                Cell Cell = ParentObject.GetCurrentCell();

                Mutations ParentsMutations = ParentObject.GetPart <Mutations>();
                if (ParentObject.HasEffect("Flying"))
                {
                    if (IsPlayer())
                    {
                        AddPlayerMessage("You cannot do this while flying");
                    }
                    return(false);
                }
                else if (!Cell.HasObjectWithPart("LiquidVolume"))
                {
                    AddPlayerMessage("You try to dive into the earth, you imagine this would be easier if the ground were, say, just a tad less hard.");
                    return(false);
                }
                else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200)
                {
                    AddPlayerMessage("Its too shallow to dive in!");
                    return(false);
                }
                else if (ParentObject.HasEffect("Submerged"))
                {
                    // AddPlayerMessage("Your return to the surface.");
                    ParentObject.Splatter("{{B|*}}");
                    ParentObject.RemoveEffect("Submerged");
                }
                else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200 && ParentsMutations.HasMutation("Amphibious"))
                {
                    AddPlayerMessage("You feel right at home.");
                    ParentObject.Splatter("{{B|*}}");
                    ParentObject.ApplyEffect(new Submerged(Duration: Effect.DURATION_INDEFINITE));
                }
                else if ((Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200 && !ParentsMutations.HasMutation("Amphibious"))
                {
                    ParentObject.Splatter("{{B|*}}");
                    ParentObject.ApplyEffect(new Submerged(Duration: Effect.DURATION_INDEFINITE));
                }
            }
            else if (E.ID == "EndTurn")
            {
                Cell Cell = ParentObject.GetCurrentCell();

                if (ParentObject.HasEffect("Flying") && (ParentObject.HasEffect("Submerged")))
                {
                    ParentObject.RemoveEffect(new Flying());
                    AddPlayerMessage("Removing Paradox Incident.");
                }
                else if (ParentObject.IsHealingPool() && ParentObject.HasEffect("Submerged"))
                {
                    ParentObject.Heal(+ParentObject.Statistics["Toughness"].Modifier);
                }
                else if (((!Cell.HasObjectWithPart("LiquidVolume") || (Cell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume < 200) && ParentObject.HasEffect("Submerged")))
                {
                    ParentObject.Splash("{{b|*}}");
                    ParentObject.RemoveEffect("Submerged");
                    return(false);
                }
            }
            //...---------------------------------------------------------------------------------------------
            else if (E.ID == "DeepStrikeCommand")
            {
                if (!ParentObject.HasEffect("Submerged") && ParentObject.IsPlayer())
                {
                    AddPlayerMessage("You must be submerged in deep pools of liquid to use this attack.");
                }
                else if (!ParentObject.HasEffect("Submerged") && !ParentObject.IsPlayer())
                {
                }
                else if (ParentObject.HasEffect("Submerged"))
                {
                    string Direction = E.GetStringParameter("Direction");

                    if (Direction == null)
                    {
                        if (ParentObject != null)
                        {
                            Direction = PickDirectionS();
                            try
                            {
                                Patch_PhaseAndFlightMatches.TemporarilyDisabled = true;
                                Event e     = Event.New("CommandAttackDirection", "Direction", Direction);
                                bool  num11 = FireEvent(e);
                                ParentObject.FireEvent(e);
                                XDidY(ParentObject, "rush", "from the depths to strike!", "!", "C", ParentObject);
                                Patch_PhaseAndFlightMatches.TemporarilyDisabled = false;
                            }
                            catch
                            {
                            }
                        }
                    }
                }
            }
            else if (E.ID == "AIGetOffensiveMutationList")
            {
                //AddPlayerMessage("I'mma keel yo ass.");
                if (IsMyActivatedAbilityAIUsable(DiveActivatedAbility))
                {
                    if (!ParentObject.HasEffect("Submerged") && (ParentObject.CurrentCell.GetFirstObjectWithPart("LiquidVolume") as GameObject).LiquidVolume.Volume >= 200)
                    {
                        E.AddAICommand("DiveCommand");
                    }
                }
                int intParameter = E.GetIntParameter("Distance");
                if (E.GetGameObjectParameter("Target") != null && intParameter <= 1 && !ParentObject.IsFrozen() && IsMyActivatedAbilityAIUsable(DeepStrikeActivatedAbility))
                {
                    E.AddAICommand("DeepStrikeCommand");
                }
            }
            else if (E.ID == "BeginTakeAction")
            {
                if (ParentObject.HasEffect("Flying") && (ParentObject.HasEffect("Submerged")))
                {
                    ParentObject.RemoveEffect(new Flying());
                    AddPlayerMessage("Removing Paradox Incident.");
                }
            }

            return(base.FireEvent(E));
        }
Esempio n. 42
0
        /// <summary>
        /// Called when the <see cref="DropDown"/> property changed.
        /// </summary>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        protected virtual void OnDropDownChanged(FrameworkElement oldValue, FrameworkElement newValue)
        {
            // Remove previous drop-down element.
            if (_contextMenu != null)
            {
                if (_contextMenuRoot != null)
                {
                    RemoveLogicalChild(_contextMenuRoot);
                    _contextMenuRoot = null;
                }

                BindingOperations.ClearBinding(_contextMenu, ContextMenu.IsOpenProperty);
                _contextMenu.ClearValue(ContextMenu.PlacementProperty);
                _contextMenu.ClearValue(ContextMenu.PlacementTargetProperty);
                _contextMenu = null;
            }
            else if (_popup != null)
            {
                RemoveLogicalChild(_popup);

                _popup.Opened             -= OnPopupOpened;
                _popup.MouseDown          -= OnPopupMouseDown;
                _popup.ContextMenuOpening -= OnPopupContextMenuOpening;
                BindingOperations.ClearBinding(_popup, Popup.IsOpenProperty);
                _popup.ClearValue(Popup.PlacementProperty);
                _popup.ClearValue(Popup.PlacementTargetProperty);
                _popup = null;
            }

            // Use new drop-down element.
            _contextMenu = newValue as ContextMenu;
            if (_contextMenu != null)
            {
                _contextMenu.Placement       = PlacementMode.Bottom;
                _contextMenu.PlacementTarget = this;
                BindToIsDropDownOpen(_contextMenu, ContextMenu.IsOpenProperty);

                // Add as logical child for data binding and routed commands.
                _contextMenu.IsOpen = true;
                DependencyObject element = _contextMenu;
                do
                {
                    _contextMenuRoot = element;
                    element          = LogicalTreeHelper.GetParent(element);
                } while (null != element);
                _contextMenu.IsOpen = false;
                AddLogicalChild(_contextMenuRoot);
            }
            else
            {
                _popup = newValue as Popup;
                if (_popup == null)
                {
                    _popup = new Popup
                    {
                        AllowsTransparency = true,
                        Child = new SystemDropShadowChrome
                        {
                            Color  = SystemParameters.DropShadow ? Color.FromArgb(113, 0, 0, 0) : Colors.Transparent,
                            Margin = SystemParameters.DropShadow ? new Thickness(0, 0, 5, 5) : new Thickness(0),
                            SnapsToDevicePixels = true,
                            Child = newValue
                        }
                    };
                }
                _popup.Placement       = PlacementMode.Bottom;
                _popup.PlacementTarget = this;
                BindToIsDropDownOpen(_popup, Popup.IsOpenProperty);
                _popup.Opened    += OnPopupOpened;
                _popup.MouseDown += OnPopupMouseDown;

                // We need to stop the context menu of the drop down button or its ancestors from
                // opening in the popup.
                if (_popup.ContextMenu == null)
                {
                    _popup.ContextMenuOpening += OnPopupContextMenuOpening;
                }

                // Add as logical child for data binding and routed commands.
                AddLogicalChild(_popup);
            }
        }
Esempio n. 43
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.DisplayASimpleMap);

            ShapeFileFeatureLayer txwatFeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXwat.shp"));

            txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(255, 153, 179, 204);
            txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("LandName", "Arial", 9, DrawingFontStyles.Italic, GeoColor.StandardColors.Navy);
            txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultTextStyle.SuppressPartialLabels = true;
            txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer txlkaA40FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA40.shp"));

            txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel14.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGray, 1F, false);
            txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 3F, GeoColor.StandardColors.DarkGray, 5F, true);
            txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 8F, GeoColor.StandardColors.DarkGray, 10F, true);
            txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 10f, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1);
            txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true;
            txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            txlkaA40FeatureLayer.DrawingMarginPercentage = 80;

            ShapeFileFeatureLayer txlkaA20FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA20.shp"));

            txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 255, 255, 128), 6, GeoColor.StandardColors.LightGray, 9, true);
            txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 255, 255, 128), 9, GeoColor.StandardColors.LightGray, 12, true);
            txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1);
            txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true;
            txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            Marker thinkGeoMarker = new Marker(BaseContext);

            thinkGeoMarker.Position = new PointShape(-96.809523, 33.128675);
            thinkGeoMarker.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeResource(ThinkGeo.MapSuite.Android.Resources, Resource.Drawable.Pin));
            thinkGeoMarker.YOffset = -(int)(22 * ThinkGeo.MapSuite.Android.Resources.DisplayMetrics.Density);

            MarkerOverlay markerOverlay = new MarkerOverlay();

            markerOverlay.Markers.Add(thinkGeoMarker);

            ImageView imageView = new ImageView(this);

            imageView.SetImageResource(Resource.Drawable.ThinkGeoLogo);

            TextView textView = new TextView(this);

            textView.Text = string.Format("Longitude : {0:N4}" + "\r\n" + "Latitude : {1:N4}", thinkGeoMarker.Position.X, thinkGeoMarker.Position.Y);
            textView.SetTextColor(Color.Black);
            textView.SetTextSize(ComplexUnitType.Px, 22);

            LinearLayout linearLayout = new LinearLayout(this);

            linearLayout.SetPadding(10, 10, 10, 10);
            linearLayout.Orientation = Orientation.Vertical;
            linearLayout.AddView(imageView);
            linearLayout.AddView(textView);

            Popup popup = new Popup(this);

            popup.Position = thinkGeoMarker.Position;
            popup.YOffset  = (int)(-44 * ThinkGeo.MapSuite.Android.Resources.DisplayMetrics.Density);
            popup.XOffset  = (int)(4 * ThinkGeo.MapSuite.Android.Resources.DisplayMetrics.Density);
            popup.AddView(linearLayout);

            PopupOverlay popupOverlay = new PopupOverlay();

            popupOverlay.Popups.Add(popup);

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(txwatFeatureLayer);
            layerOverlay.Layers.Add(txlkaA20FeatureLayer);
            layerOverlay.Layers.Add(txlkaA40FeatureLayer);

            androidMap               = FindViewById <MapView>(Resource.Id.androidmap);
            androidMap.MapUnit       = GeographyUnit.DecimalDegree;
            androidMap.CurrentExtent = new RectangleShape(-96.8172, 33.1299, -96.8050, 33.1226);
            androidMap.Overlays.Add(layerOverlay);
            androidMap.Overlays.Add(markerOverlay);
            androidMap.Overlays.Add(popupOverlay);

            SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType());
        }
Esempio n. 44
0
 public void Awake()
 {
     Self        = this;
     PopupPrefab = Resources.Load <GameObject>("GUI/PopupPrefab");
 }
Esempio n. 45
0
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                mainPanel = (StrokeToolPanelHorizontal_Reader)target;
                break;

            case 2:
                undoButton        = (Button)target;
                undoButton.Click += new RoutedEventHandler(undoButtonClick);
                break;

            case 3:
                redoButton        = (Button)target;
                redoButton.Click += new RoutedEventHandler(redoButtonClick);
                break;

            case 4:
                penButton        = (Button)target;
                penButton.Click += new RoutedEventHandler(penButtonClick);
                break;

            case 5:
                penTypePopup = (Popup)target;
                break;

            case 6:
                penSubPanelGrid = (Grid)target;
                break;

            case 7:
                curveButton        = (Button)target;
                curveButton.Click += new RoutedEventHandler(curveButtonClick);
                break;

            case 8:
                straightPanelButton        = (Button)target;
                straightPanelButton.Click += new RoutedEventHandler(LineButtonClick);
                break;

            case 9:
                colorPanelButton        = (Button)target;
                colorPanelButton.Click += new RoutedEventHandler(colorPanelButtonClick);
                break;

            case 10:
                colorPopup = (Popup)target;
                break;

            case 11:
                penToolPanelGrid = (Grid)target;
                break;

            case 12:
                transparentButton        = (Button)target;
                transparentButton.Click += new RoutedEventHandler(transparentButton_Click);
                break;

            case 13:
                nonTransparentButton        = (Button)target;
                nonTransparentButton.Click += new RoutedEventHandler(nonTransparentButton_Click);
                break;

            case 14:
                demoStroke = (Path)target;
                break;

            case 15:
                strokeWidthSlider = (Slider)target;
                strokeWidthSlider.ValueChanged += new RoutedPropertyChangedEventHandler <double>(strokeHeight_ValueChanged);
                break;

            case 16:
                colorPanel = (Grid)target;
                break;

            case 17:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 18:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 19:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 20:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 21:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 22:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 23:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 24:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 25:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 26:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 27:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 28:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 29:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 30:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 31:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 32:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 33:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 34:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 35:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 36:
                ((Button)target).Click += new RoutedEventHandler(setColor);
                break;

            case 37:
                eraserButton        = (Button)target;
                eraserButton.Click += new RoutedEventHandler(eraserButtonClick);
                break;

            case 38:
                deleteAllButton        = (Button)target;
                deleteAllButton.Click += new RoutedEventHandler(deleteAllButtonClick);
                break;

            default:
                _contentLoaded = true;
                break;
            }
        }
Esempio n. 46
0
 public void OnOpened(Popup popup)
 {
     Popup = popup;
     PlaylistPickerListView.ItemClick += PlaylistPickerListViewOnItemClick;
 }
Esempio n. 47
0
 public static void Hide(this Popup popupElement, Func <bool> precondition, Action postAction) => ShowHide(popupElement, precondition, postAction, false);
Esempio n. 48
0
 public AutoCompleteBase2(IAutoCompleteAlgorithm2 Algorithm, TextBox SearchText, Popup AutoComplete, ListBox AutoCompleteList)
 {
     this.SearchText       = SearchText;
     this.AutoComplete     = AutoComplete;
     this.AutoCompleteList = AutoCompleteList;
     this.Algorithm        = Algorithm;
 }
Esempio n. 49
0
 public static UIElement GetContent(this Popup popup) => (popup.Child as ContentControl).Content as UIElement;
        public async void Show()
        {
            await Init();

            var appView = ApplicationView.GetForCurrentView();

            popup = new Popup();
            //popup.IsLightDismissEnabled = true;
            popup.Child = this;
            this.Height = appView.VisibleBounds.Height;
            this.Width  = appView.VisibleBounds.Width;
            if (CommonLibrary.DeviceInfoHelper.IsStatusBarPresent)
            {
                this.Margin = new Thickness(0, 24, 0, 0);
            }
            //popup.VerticalOffset = Window.Current.Bounds.Height / 2;

            EventHandler <Windows.UI.Core.BackRequestedEventArgs> PageNavHelper_BeforeBackRequest = (s, e) =>
            {
                if (popup.IsOpen)
                {
                    e.Handled    = true;
                    popup.IsOpen = false;
                }
            };

            TypedEventHandler <ApplicationView, object> handler = (s, e) =>
            {
                try
                {
                    if (popup.IsOpen)
                    {
                        this.Height = appView.VisibleBounds.Height;
                        this.Width  = appView.VisibleBounds.Width;
                    }
                }
                catch (Exception ex)
                {
                    // ignored
                    Debug.WriteLine(ex);
                }
            };

            TappedEventHandler tapped = (s, e) =>
            {
                if (popup.IsOpen)
                {
                    //popup.IsOpen = false;
                }
            };

            popup.Opened += (s, e) =>
            {
                this.Visibility               = Visibility.Visible;
                mask_grid.Tapped             += tapped;
                appView.VisibleBoundsChanged += handler;
                //PageNavHelper.BeforeFrameBackRequest += PageNavHelper_BeforeBackRequest;
            };

            popup.Closed += (s, e) =>
            {
                this.Visibility               = Visibility.Collapsed;
                mask_grid.Tapped             -= tapped;
                appView.VisibleBoundsChanged -= handler;
                //PageNavHelper.BeforeFrameBackRequest -= PageNavHelper_BeforeBackRequest;
            };

            popup.IsOpen = true;
        }
Esempio n. 51
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            ItemContainer     = GetTemplateChild("Container") as StackPanel;
            MainContainer     = GetTemplateChild("MainContainer") as Grid;
            AverageTick       = GetTemplateChild("AverageTick") as Border;
            BottomTick        = GetTemplateChild("BottomTick") as Border;
            MaxValueLabel     = GetTemplateChild("MaxValueLabel") as TextBlock;
            AverageBorder     = GetTemplateChild("AverageBorder") as Border;
            AverageLabel      = GetTemplateChild("AverageLabel") as TextBlock;
            BottomValueBorder = GetTemplateChild("BottomValueBorder") as Border;
            BottomValueLabel  = GetTemplateChild("BottomValueLabel") as TextBlock;
            ItemsScrollViewer = GetTemplateChild("ItemsScrollViewer") as ScrollViewer;
            ScrollLeftButton  = GetTemplateChild("ScrollLeftButton") as Button;
            ScrollRightButton = GetTemplateChild("ScrollRightButton") as Button;
            Popup             = GetTemplateChild("Popup") as Popup;
            BottomPopup       = GetTemplateChild("BottomPopup") as Popup;


            if (ScrollLeftButton != null)
            {
                ScrollLeftButton.Click += ScrollButton_Click;
            }
            if (ScrollRightButton != null)
            {
                ScrollRightButton.Click += ScrollButton_Click;
            }

            if (ItemsScrollViewer != null)
            {
                ItemsScrollViewer.PreviewMouseWheel += ItemsScrollViewer_PreviewMouseWheel;
                ItemsScrollViewer.MouseEnter        += ItemsScrollViewer_MouseEnter;
            }
            if (AverageTick != null)
            {
                AverageTick.MouseEnter += (s, c) =>
                {
                    VisualStateManager.GoToElementState(AverageTick, "AverageTickMouseEnter", true);
                    Popup.IsOpen = true;
                };
                AverageTick.MouseLeave += (s, c) =>
                {
                    VisualStateManager.GoToElementState(AverageTick, "AverageTickMouseLeave", true);
                    if (!Popup.IsFocused)
                    {
                        Popup.IsOpen = false;
                    }
                };
            }
            if (BottomTick != null)
            {
                BottomTick.MouseEnter += (s, c) =>
                {
                    VisualStateManager.GoToElementState(BottomTick, "BottomTickMouseEnter", true);
                    BottomPopup.IsOpen = true;
                };
                BottomTick.MouseLeave += (s, c) =>
                {
                    VisualStateManager.GoToElementState(BottomTick, "BottomTickMouseLeave", true);
                    if (!BottomPopup.IsFocused)
                    {
                        BottomPopup.IsOpen = false;
                    }
                };
            }
            MouseLeave += Chart_MouseLeave;
            Loaded     += Chart_Loaded;
        }
Esempio n. 52
0
 public static bool SetButton3Part(this Popup popup, EvasObject content, bool preserveOldContent = false)
 {
     return(popup.SetPartContent(ThemeConstants.Popup.Parts.Button3, content, preserveOldContent));
 }
        private void textBox4_Click(object sender, EventArgs e)
        {
            var cityInfo = cbBoxCity.SelectedItem as City;
            if (cityInfo == null)
            {
                return;
            }
            var cityID = cityInfo.CityID;

            var storeListControl = new StoreListControl(textBox4, cityID);
            storeListControl.AfterChangeStoreEvent += ClearStoreEntityText;
            var pop = new Popup(storeListControl);
            pop.Show(textBox4, false);
        }
Esempio n. 54
0
        /// <summary>
        /// Closes the popup once the fade-out animation completed.
        /// The animation was triggered in XAML through the attached
        /// BalloonClosing event.
        /// </summary>
        private void OnFadeOutCompleted(object sender, EventArgs e)
        {
            Popup pp = (Popup)Parent;

            pp.IsOpen = false;
        }
        private void btnShow_Click(object sender, EventArgs e)
        {
            var busPhotoAlbum = chbShowPicBox.SelectedItem as BusPhotoAlbum;
            if (busPhotoAlbum == null)
            {
                return;
            }

            var showDishListControl = new ShowDishListControl(busPhotoAlbum.StorePicturesList);
            var pop = new Popup(showDishListControl);
            pop.Show(btnShowDish, false);
        }
Esempio n. 56
0
        public AppPopup(
            IAppPopupContent content,
            double width        = double.NaN,
            double height       = double.NaN,
            double widthMargin  = double.NaN,
            double heightMargin = double.NaN,
            double minWidth     = 0,
            double maxWidth     = double.MaxValue,
            double minHeight    = 0,
            double maxHeight    = double.MaxValue,
            bool lightDismiss   = false,
            bool useAnimation   = true,
            Action <IAppPopupContent>?opening          = null,
            Action <IAppPopupContent, object?>?closing = null)
        {
            _content      = content;
            _width        = width;
            _height       = height;
            _opening      = opening;
            _closing      = closing;
            _maxWidth     = maxWidth;
            _widthMargin  = widthMargin;
            _heightMargin = heightMargin;
            _minWidth     = minWidth;
            _maxWidth     = maxWidth;
            _minHeight    = minHeight;
            _maxHeight    = maxHeight;
            _useAnimation = useAnimation;
            var(windowWidth, windowHeight) = App.AppViewModel.GetAppWindowSizeTuple();
            UniqueId = content.UniqueId;
            content.UIContent.HorizontalAlignment = HorizontalAlignment.Stretch;
            content.UIContent.VerticalAlignment   = VerticalAlignment.Stretch;

            var themeShadow    = new ThemeShadow();
            var shadowReceiver = new Grid
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Background          = (Brush)Application.Current.Resources["ApplicationPageBackgroundThemeBrush"],
                Opacity             = 0.4
            };
            var popupContentPresenter = new ContentPresenter
            {
                Shadow              = themeShadow,
                Translation         = new Vector3(0, 0, 40),
                BorderBrush         = (Brush)Application.Current.Resources["PixevalBorderBrush"],
                Background          = (Brush)Application.Current.Resources["PixevalPanelBackgroundThemeBrush"],
                BorderThickness     = new Thickness(0.3),
                CornerRadius        = new CornerRadius(10),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Content             = content
            };

            themeShadow.Receivers.Add(shadowReceiver);

            if (lightDismiss)
            {
                shadowReceiver.Tapped += OnShadowReceiverOnTapped;
            }
            else
            {
                shadowReceiver.Tapped -= OnShadowReceiverOnTapped;
            }

            void OnShadowReceiverOnTapped(object sender, TappedRoutedEventArgs a)
            {
                PopupManager.ClosePopup(PopupManager.OpenPopups[UniqueId]);
            }

            Popup = new Popup
            {
                RequestedTheme = App.AppViewModel.AppRootFrameTheme,
                Transitions    = new TransitionCollection
                {
                    new PopupThemeTransition()
                },
                XamlRoot = App.AppViewModel.AppWindowRootFrame.XamlRoot,
                Width    = windowWidth,
                Height   = windowHeight,
                Child    = new Grid
                {
                    Children =
                    {
                        shadowReceiver, popupContentPresenter
                    }
                }
            };
            App.AppViewModel.Window.SizeChanged += WindowOnSizeChanged;
        }
Esempio n. 57
0
 public AddContactsUserControl(Popup PopupCallerId)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.PopupCallerId = PopupCallerId;
 }
Esempio n. 58
0
        public Waypoint(MainWindow window, GMapMarker marker, bool mode, int _no, bool _icon)
        {
            InitializeComponent();

            DeviceFlag = mode;


            //アイコンを変更
            if (_icon)
            {
                icon.Source = new BitmapImage(new Uri(System.IO.Path.GetFullPath("Resources/UavWayPoint.png")));
            }
            else
            {
                icon.Source          = new BitmapImage(new Uri(System.IO.Path.GetFullPath("Resources/MultiWayPoint.png")));
                Main.RenderTransform = new ScaleTransform(0.5, 0.5);                    //マーカーサイズ縮小
            }

            /*
             * //イベント管理
             * if (DeviceFlag)
             * {
             *  this.MouseLeave -= new System.Windows.Input.MouseEventHandler(this.MarkerControl_MouseLeave);
             *  this.MouseMove -= new System.Windows.Input.MouseEventHandler(this.UAVWayPoint_MouseMove);
             *  this.MouseLeftButtonUp -= new System.Windows.Input.MouseButtonEventHandler(this.UAVWayPoint_MouseLeftButtonUp);
             *  this.MouseLeftButtonDown -= new System.Windows.Input.MouseButtonEventHandler(this.UAVWayPoint_MouseLeftButtonDown);
             * }
             * else
             * {
             *
             *  this.MouseLeave += new System.Windows.Input.MouseEventHandler(this.MarkerControl_MouseLeave);
             *  this.MouseMove += new System.Windows.Input.MouseEventHandler(this.UAVWayPoint_MouseMove);
             *  this.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.UAVWayPoint_MouseLeftButtonUp);
             *  this.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.UAVWayPoint_MouseLeftButtonDown);
             *
             * }
             */
            this.MainWindow  = window;
            this.Marker      = marker;
            this.Marker.ID   = _no;
            this.Marker.Mode = 0;

            Popup = new Popup();    //ポップアップ表示
            Label = new Label();    //ポップアップのコメント表示

            Popup.Placement = PlacementMode.Mouse;
            {
                Label.Background      = Brushes.Blue;
                Label.Foreground      = Brushes.White;
                Label.BorderBrush     = Brushes.WhiteSmoke;
                Label.BorderThickness = new Thickness(2);
                Label.Padding         = new Thickness(5);
                Label.FontSize        = 12;
                Label.Content         = "ID/" + this.Marker.ID.ToString() +
                                        "\n纬度/" + this.Marker.Position.Lat.ToString("0.0000000") +
                                        "\n经度/" + this.Marker.Position.Lng.ToString("0.0000000") +
                                        "\n角度/" + this.Marker.Azimuth.ToString("0.0000000") +
                                        "\n高度/" + this.Marker.Altitude.ToString("0.0000000") +
                                        "\n速度/" + this.Marker.Speed.ToString("0.0000000");
            }
            Popup.Child = Label;

            Number.Content = this.Marker.ID.ToString();

            var task = Task.Factory.StartNew(() =>
            {
                while (EndFlag)
                {
                    if (UavAngSw && cnt > PushTime)   //cnt(長押し)
                    {
                        modeFlag = true;
                    }
                    else if (!UavAngSw)
                    {
                        modeFlag = false;
                        cnt      = 0;
                    }

                    Dispatcher.BeginInvoke(new Action <int>(Worker), ang);
                    System.Threading.Thread.Sleep(10);   //1msec
                    ++cnt;
                }
            });
        }
Esempio n. 59
0
        private void AddPopup(Currency currency, double amount, TransactionReasons transactionReason, string reason, Transform referencePosition, AnchorType anchorType, bool isDelta, bool isFacility = false)
        {
            Popup popup = new Popup();
            popup.currency = currency;
            popup.amount = amount;
            popup.transactionReason = transactionReason;
            popup.reason = reason;
            popup.anchorType = anchorType;
            popup.referencePosition = referencePosition;
            popup.isFacility = isFacility;
            popup.isDelta = isDelta;

            // Special stuff
            if (isFacility)
            {
                popup.initialized = false;
            }

            // Attempt to combine duplicates
            Popup last = popups.LastOrDefault();
            if (last != null && last.currency == currency && last.transactionReason == transactionReason && last.reason == reason)
            {
                last.amount += amount;
            }
            else
            {
                popups.Add(popup);
            }
        }
Esempio n. 60
-1
        /// <summary>
        /// Shows a context menu for the specified control.
        /// </summary>
        /// <param name="control">The control.</param>
        private void Show(Control control)
        {
            if (control != null)
            {
                if(_popup == null)
                {
                    _popup = new Popup()
                    {
                        PlacementMode = PlacementMode.Pointer,
                        PlacementTarget = control,
                        StaysOpen = false                                         
                    };

                    _popup.Closed += PopupClosed;
                }

                ((ISetLogicalParent)_popup).SetParent(control);
                _popup.Child = control.ContextMenu;

                _popup.Open();

                control.ContextMenu._isOpen = true;
            }
        }