Esempio n. 1
0
        /// <summary>
        /// Mensagem por Popup
        /// </summary>
        /// <param name="Texto">Mensagem a ser exibida</param>
        /// <param name="Icone">1-Informação, 2-Interrogação, 3-Exclamação, 4-Proibido</param>
        /// <returns></returns>
        public static bool PopupBox(string Texto, int Icone)
        {
            PopupBox _popupBox = new PopupBox(Texto, Icone);

            _popupBox.ShowDialog();
            return(_popupBox.Result);
        }
Esempio n. 2
0
        public Tuple <string, int, List <bool> > ShowDialog(PopupBox popupBox, List <bool> checkBoxOptionStates = null)
        {
            var popup = new Civ2dialog(_main, popupBox, checkboxOptionState: checkBoxOptionStates);

            popup.ShowModal(_main);
            return(Tuple.Create(popup.SelectedButton, popup.SelectedIndex, popup.CheckboxReturnStates));
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            PopupBox  pb  = new PopupBox();
            DataTable dts = InvGroup.ListGroup();

            pb.SetDataTable(dts);
            pb.Show();
        }
Esempio n. 4
0
 protected void SetCommandState(OrderStatus status = OrderStatus.Disabled, string menuText = null, string errorPopupKeyword = null)
 {
     Command.MenuText = string.IsNullOrWhiteSpace(menuText) ? _defaultLabel : menuText;
     Command.Enabled  = status == OrderStatus.Active;
     Status           = status;
     ErrorPopup       = !string.IsNullOrWhiteSpace(errorPopupKeyword) && _mainForm.popupBoxList.ContainsKey(errorPopupKeyword)
         ? _mainForm.popupBoxList[errorPopupKeyword]
         : _mainForm.popupBoxList["CANTDO"];
 }
Esempio n. 5
0
 /// <summary>
 /// Zamyka podany popupbox
 /// </summary>
 /// <param name="box">Popupbox, który ma zostać zamknięty</param>
 public void ClosePopup(PopupBox box)
 {
     if (showedPopups.Contains(box))
     {
         showedPopups.Remove(box);
     }
     boxPools[box.GetType()].ReturnObject(box.gameObject);
     RepositionPopups();
     CheckScreenAccessibility();
 }
Esempio n. 6
0
        public void text(string text)
        {
            var pop = new PopupBox
            {
                Button     = new[] { "OK" },
                Text       = new[] { text },
                LineStyles = new[] { TextStyles.Left }
            };

            _uInterfaceCommands.ShowDialog(pop);
        }
Esempio n. 7
0
        public void ToggleButtonInheritsTabIndex()
        {
            var popupBox = new PopupBox {
                TabIndex = 3
            };

            popupBox.ApplyDefaultStyle();

            ToggleButton togglePart = popupBox.FindVisualChild <ToggleButton>(PopupBox.TogglePartName);

            Assert.Equal(3, togglePart.TabIndex);
        }
Esempio n. 8
0
        public void ToggleButtonInheritsIsTabStopWhenTrue()
        {
            var popupBox = new PopupBox {
                IsTabStop = true
            };

            popupBox.ApplyDefaultStyle();

            ToggleButton togglePart = popupBox.FindVisualChild <ToggleButton>(PopupBox.TogglePartName);

            Assert.Equal(true, togglePart.IsTabStop);
        }
Esempio n. 9
0
        private void cntxtMenu_AddSurvey(object sender, RoutedEventArgs e)
        {
            //UserSession.IsNews = false;

            if (dgSurvey.SelectedItem != null && UserSession.PilotId > 0)
            {
                mdiWinow.SetAdminSection("AddEditSurvey");
            }
            else
            {
                PopupBox frmPopup = new PopupBox("Information", "Please Select a project first.", MessageBoxImage.Error);
                frmPopup.ShowDialog();
            }
        }
Esempio n. 10
0
        protected override void Layout()
        {
            if (PanelBar != null)
            {
                int panelWidth  = 352;
                int panelHeight = 40;
                PanelBar.MoveTo((Width - panelWidth) / 2, Height - panelHeight);
                PanelBar.SetSize(panelWidth, panelHeight);
            }

            if (initBox != null)
            {
                int initBoxWidth  = 16 + 320 + 16;
                int initBoxHeight = 200;
                int initBoxX      = (Width - initBoxWidth) / 2;
                int initBoxY      = (Height - initBoxHeight) / 2;
                initBox.MoveTo(initBoxX, initBoxY);
                initBox.SetSize(initBoxWidth, initBoxHeight);
            }

            if (PopupBox != null && PopupBox.Parent != null)
            {
                int popupWidth  = 144;
                int popupHeight = 160;
                int popupX      = (PopupBox.Parent.Width - popupWidth) / 2;
                int popupY      = (PopupBox.Parent.Height - popupHeight) / 2;
                PopupBox.MoveTo(popupX, popupY);
                PopupBox.SetSize(popupWidth, popupHeight);
            }

            if (NotificationBox != null)
            {
                int notificationBoxWidth  = 144; // was 200
                int notificationBoxHeight = 160; // was 88
                int notificationBoxX      = (Width - notificationBoxWidth) / 2;
                int notificationBoxY      = (Height - notificationBoxHeight) / 2;
                NotificationBox.MoveTo(notificationBoxX, notificationBoxY);
                NotificationBox.SetSize(notificationBoxWidth, notificationBoxHeight);
            }

            if (Viewport != null)
            {
                Viewport.SetSize(Width, Height);
            }

            SetRedraw();
        }
Esempio n. 11
0
 private void cntxtMenu_ViewSurvey(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dgSurvey.SelectedItem != null)
         {
             PilotSession.SurveyId = (dgSurvey.SelectedItem as SurveyModel).ID;
             mdiWinow.SetAdminSection("AddEditSurvey");
         }
         else
         {
             PopupBox frmPopup = new PopupBox("Information", "Please Select a survey first.", MessageBoxImage.Error);
             frmPopup.ShowDialog();
         }
     }
     catch
     {
     }
 }
Esempio n. 12
0
        // Open popup box
        public void OpenPopup(PopupBox.Type box)
        {
            if (PopupBox == null)
            {
                PopupBox = new PopupBox(this);
            }

            if (initBox != null)
            {
                initBox.AddChild(PopupBox, 0, 0);
            }
            else
            {
                AddChild(PopupBox, 0, 0);
            }

            Layout();
            PopupBox.Show(box);
            PanelBar?.Update();
        }
Esempio n. 13
0
        // Close the current popup.
        public void ClosePopup()
        {
            if (PopupBox == null)
            {
                return;
            }

            PopupBox.Hide();

            if (initBox != null)
            {
                initBox.DeleteChild(PopupBox);
            }
            else
            {
                DeleteChild(PopupBox);
            }

            UpdateMapCursorPosition(mapCursorPosition);
            PanelBar?.Update();
        }
        private void ShowIntellisense <T>(string text, PopupBox intellisense, ListBox listBox, IEnumerable <T> items)
        {
            if (items.Count() > 0)
            {
                this.indexOfLastIntellisenseText = this.ChatMessageTextBox.Text.LastIndexOf(text);
                listBox.ItemsSource   = items;
                listBox.SelectedIndex = items.Count() - 1;

                Rect  positionOfCarat = this.ChatMessageTextBox.GetRectFromCharacterIndex(this.ChatMessageTextBox.CaretIndex, true);
                Point topLeftOffset   = this.ChatMessageTextBox.TransformToAncestor(this).Transform(new Point(positionOfCarat.Left, positionOfCarat.Top));

                int itemHeight = items.Count() * 40;
                Canvas.SetLeft(intellisense, topLeftOffset.X + 10);
                Canvas.SetTop(intellisense, topLeftOffset.Y - itemHeight - 40);
                intellisense.UpdateLayout();

                if (!intellisense.IsPopupOpen)
                {
                    intellisense.IsPopupOpen = true;
                }
            }
        }
Esempio n. 15
0
    /// <summary>
    /// Wyświetla okno z popup-em niezależnie od tego, czy na ekranie jest na niego miejsce
    /// </summary>
    /// <param name="popup">Popup, który ma zostać wyświetlony</param>
    public void ForcePopup(Popup popup)
    {
        if (popup == null)
        {
            return;
        }

        GameObject popupBox = boxPools[boxTypes.FirstOrDefault(x => x.Value == popup.GetType()).Key].TakeObject(); //Wyciąganie popupbox-u z odpowiedniej puli w zależności od popup-u źródłowego

        //Upewniamy się, że popupbox nie jest pusty
        if (popupBox != null)
        {
            popupBox.GetComponent <Transform>().SetAsLastSibling();
            PopupBox box = popupBox.GetComponent <PopupBox>();
            box.Init(popup);       //Inicjalizacja popupbox-a według podanego patternu

            showedPopups.Add(box); //Dodawanie box-a do listy wyświetlonych box-ów
        }
        else
        {
            Debug.LogError("Nie udało się zainicjować popup-u");
        }
    }
Esempio n. 16
0
        /// <summary>
        /// Show a popup box (dialog).
        /// </summary>
        /// <param name="parent">Main window.</param>
        /// <param name="popupBox">Popupbox object read from Game.txt. Determines properties of a popup box.</param>
        /// <param name="replaceStrings">A list of strings to replace %STRING0, %STRING1, %STRING2, etc.</param>
        /// <param name="replaceNumbers">A list of numbers to replace %NUMBER0, %NUMBER1, %NUMBER2, etc.</param>
        /// <param name="checkboxOptionState">A list of boolean values representing states of checkbox options.</param>
        /// <param name="textBoxes">Definitions for any text input on the dialog</param>
        /// <param name="optionsCols">The number of columns to break options into</param>
        /// <param name="icons">Icons to show next to options</param>
        /// <param name="image">Image shown</param>
        /// <param name="listbox">Listbox shown</param>
        public Civ2dialog(Main parent, PopupBox popupBox, IList <string> replaceStrings = null, IList <int> replaceNumbers = null, IList <bool> checkboxOptionState = null, List <TextBoxDefinition> textBoxes = null, int optionsCols = 1, Bitmap[] icons = null, Bitmap image = null, ListboxDefinition listbox = null)
        {
            foreach (var item in parent.Menu.Items)
            {
                item.Enabled = false;
            }

            _paddingTop = 38;
            _paddingBtm = 46;

            WindowStyle = WindowStyle.None;

            // Drag window
            this.MouseDown += (_, e) =>
            {
                if (e.Location.Y < _paddingTop)  // Enable dragging only on top of window
                {
                    dragging        = true;
                    dragCursorPoint = this.Location + e.Location;
                    dragFormPoint   = this.Location;
                }
            };

            this.MouseMove += (_, e) =>
            {
                if (dragging)
                {
                    dif           = this.Location + e.Location - dragCursorPoint;
                    this.Location = (Point)(dragFormPoint + dif);
                }
            };

            this.MouseUp += (_, _) => dragging = false;

            var layout = new PixelLayout()
            {
                Size = new Size(Width, Height)
            };

            if (popupBox.Text is not null)
            {
                _text = popupBox.Text.ToList();
            }
            _listbox        = listbox;
            _image          = image;
            _icons          = icons ?? Array.Empty <Bitmap>();
            _optionsColumns = optionsCols < 1 ? 1 : optionsCols;
            if (checkboxOptionState is not null)
            {
                CheckboxReturnStates = new List <bool>(checkboxOptionState);                                 // Initialize return checkbox states
            }
            // Fill text into textboxes & then remove it from popubox Text
            if (textBoxes is not null)
            {
                if (popupBox.Options?.Count > 0)
                {
                    SetTextBoxText(textBoxes, popupBox.Options);
                    popupBox.Options = null;
                }
                else
                {
                    SetTextBoxText(textBoxes, _text);
                    _text = _text.Take(textBoxes[0].index - 1).ToList();
                }
            }

            // Format title & adjust inner panel width to fit the title
            if (!string.IsNullOrWhiteSpace(popupBox.Title))
            {
                _fTitle          = GetFormattedTitle(popupBox.Title, replaceStrings, replaceNumbers);
                _innerSize.Width = (int)_fTitle.Measure().Width - 2 * 11;
            }

            // Determine size of text and based on that determine inner panel size
            _textHeight = 0;
            if (_text?.Count > 0)
            {
                _fTexts          = GetFormattedTexts(_text, popupBox.LineStyles.ToList(), replaceStrings, replaceNumbers);
                _innerSize.Width = Math.Max(_innerSize.Width, GetInnerPanelWidthFromText(_fTexts, popupBox));
                foreach (var fText in _fTexts)
                {
                    fText.MaximumWidth = _innerSize.Width; // Adjust text width to inner panel width
                }

                var totalHeight = _fTexts.Sum(fText => fText.Measure().Height / 28.0) * 28;
                _textHeight = (int)Math.Round(totalHeight);
                foreach (var fText in _fTexts)
                {
                    _innerSize.Height += (int)Math.Round(fText.Measure().Height / 28.0) * 28;
                }
            }

            // Correction of inner panel size for options
            _optionsRows = GetOptionsRows(popupBox.Options?.Count, _optionsColumns);
            var iconsHeight = _icons.Length == 0 ? 0 : _icons.Sum(i => i.Height) + 4 * (_icons.Length - 1);

            _innerSize = new Size(Math.Max(_innerSize.Width, GetInnerPanelWidthFromOptions(popupBox, _optionsRows, _optionsColumns, _icons, textBoxes)),
                                  (_optionsRows - _icons.Length) * 32 + iconsHeight + _textHeight);

            // Correction of inner panel size for image
            _innerSize = new Size(Math.Max(_innerSize.Width, _image?.Width ?? 0), Math.Max(_innerSize.Height, _image?.Height ?? 0));

            // Correction of inner panel size for textbox
            _innerSize = new Size(_innerSize.Width, _innerSize.Height + (30 * textBoxes?.Count ?? 0));

            _listboxShownLines = popupBox.ListboxLines;
            _listboxHeight     = _listboxShownLines * 23 + 2;
            _innerSize.Height += _listboxHeight;
            Size = new Size(_innerSize.Width + 2 * 2 + 2 * 11, _innerSize.Height + 2 * 2 + _paddingTop + _paddingBtm);

            // Dialog location on screen (center by default)
            int locX, locY;

            if (popupBox.X is not null && popupBox.X < 0)
            {
                locX = (int)(popupBox.X.HasValue ? popupBox.X + (int)Screen.WorkingArea.Width - Width : parent.Width / 2 - Width / 2);
            }
Esempio n. 17
0
        private static void OnLoad(object sender, RoutedEventArgs e)
        {
            var This = (sender as TopAppBar_Apps);

            if (This.m_CheckIfHandlerShouldExecute == false)
            {
                return;
            }

            /////////////////////////////////////////////////////////////////////////////////

            // PopupBox Button
            var PopupBox1 = new PopupBox()
            {
                Name = "TopAppBar_Notifications_PopupBox1",
                //Style = _this.FindResource("MaterialDesignToolPopupBox") as Style,
                //Width = 32, Height = 32,
                ClipToBounds               = true,
                StaysOpen                  = true,
                Margin                     = new Thickness(0),
                Padding                    = new Thickness(0),
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalAlignment          = VerticalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Foreground                 = This.FindResource("MaterialDesignPaper") as Brush,
                PopupMode                  = PopupBoxPopupMode.Click,
                UnfurlOrientation          = Orientation.Vertical,
                PlacementMode              = PopupBoxPlacementMode.BottomAndAlignRightEdges,
                FlowDirection              = FlowDirection.LeftToRight,
                SnapsToDevicePixels        = true,
            };

            //EventManager.RegisterClassHandler(typeof(PopupBox), PopupBox.OpenedEvent, new RoutedEventHandler(OnPopupOpened));

            var PackIcon1 = new PackIcon()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Width      = 18,
                Height     = 18,
                Kind       = PackIconKind.Apps,
                Foreground = This.FindResource("MaterialDesignPaper") as Brush,
            }; PopupBox1.ToggleContent = PackIcon1;

            ShadowAssist.SetShadowDepth(PopupBox1, ShadowDepth.Depth0);
            RippleAssist.SetRippleSizeMultiplier(PopupBox1, 0.5f);
            RippleAssist.SetClipToBounds(PopupBox1, false);
            RippleAssist.SetIsCentered(PopupBox1, true);
            RippleAssist.SetIsDisabled(PopupBox1, true);

            // PopupBox Button End

            // Card
            var PrimaryStackPanel1 = new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Orientation         = Orientation.Vertical,
            };

            var HeaderStackPanel1 = new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Orientation         = Orientation.Vertical,
                Background          = Brushes.WhiteSmoke,
            };

            var TextBlock1 = new TextBlock()
            {
                FontFamily    = new FontFamily("Roboto"),
                Padding       = new Thickness(96, 9, 96, 9),
                TextAlignment = TextAlignment.Center,
                FontSize      = 13,
                Opacity       = 0.75f,
                Text          = Application.Current.MainWindow.Title == "" ? "Apps" : Application.Current.MainWindow.Title,
                //Background = Brushes.Purple,
            };

            HeaderStackPanel1.Children.Add(TextBlock1);

            var Button1 = new Button()
            {
                Style   = This.FindResource("MaterialDesignToolButton") as Style,
                Height  = 16,
                Content = new PackIcon()
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Width   = 11,
                    Height  = 11,
                    Kind    = PackIconKind.ArrowCollapseDown,
                    Margin  = new Thickness(0, 0, 0, 0),
                    Padding = new Thickness(0, 0, 0, 0),
                },
                Padding    = new Thickness(0, 0, 0, 0),
                Margin     = new Thickness(0, 0, 0, 0),
                Background = Brushes.Gainsboro,
            };

            ShadowAssist.SetShadowEdges(Button1.Content as PackIcon, ShadowEdges.Top);
            ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1);
            ShadowAssist.SetShadowEdges(Button1, ShadowEdges.Top);
            ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1);
            RippleAssist.SetIsDisabled(Button1, false);
            RippleAssist.SetIsCentered(Button1, true);
            RippleAssist.SetClipToBounds(Button1, true);
            RippleAssist.SetRippleSizeMultiplier(Button1, 12.0f);

            var ListView1 = new StackPanel()
            {
                MinWidth      = 96, MinHeight = 192,
                Orientation   = Orientation.Horizontal,
                FlowDirection = FlowDirection.LeftToRight,
                //HorizontalContentAlignment = HorizontalAlignment.Left,
                //VerticalContentAlignment = VerticalAlignment.Top,
                Background = Brushes.WhiteSmoke,
            };

            //ListView1.Children.Add(new TextBlock()
            //{
            //    FontSize = 11,
            //    Opacity = 0.75f,
            //    Text = "Nothing to see here!",
            //    //Width = 80, Height = 40,
            //    TextAlignment = TextAlignment.Center,
            //    HorizontalAlignment = HorizontalAlignment.Stretch,
            //    VerticalAlignment = VerticalAlignment.Stretch,
            //    Margin = new Thickness(0, 96, 0, 96),
            //});

            var Button_App1 = new Button()
            {
                Name                = "TopAppBar_Apps_App1_Button",
                Style               = This.FindResource("MaterialDesignFlatButton") as Style,
                Margin              = new Thickness(4),
                Padding             = new Thickness(0),
                Width               = 48, Height = 48,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Content             = new PackIcon()
                {
                    Width               = 32, Height = 32,
                    Padding             = new Thickness(0),
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Margin              = new Thickness(0),
                    //Foreground = This.FindResource("MaterialDesignPaper") as Brush,
                    Kind = PackIconKind.Launch,
                },
                ToolTip = "Launch Portal"
            };

            RippleAssist.SetClipToBounds(Button_App1, true);
            RippleAssist.SetIsCentered(Button_App1, true);
            ShadowAssist.SetShadowDepth(Button_App1, ShadowDepth.Depth1);
            ListView1.Children.Add(Button_App1);

            var Button_App0 = new Button()
            {
                Name                = "TopAppBar_Apps_App0_Button",
                Style               = This.FindResource("MaterialDesignFlatButton") as Style,
                Margin              = new Thickness(4),
                Padding             = new Thickness(0),
                Width               = 48,
                Height              = 48,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Content             = new PackIcon()
                {
                    Width               = 32,
                    Height              = 32,
                    Padding             = new Thickness(0),
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Margin              = new Thickness(0),
                    //Foreground = This.FindResource("MaterialDesignPaper") as Brush,
                    Kind = PackIconKind.Home,
                },
                ToolTip = "Home"
            };

            RippleAssist.SetClipToBounds(Button_App0, true);
            RippleAssist.SetIsCentered(Button_App0, true);
            ShadowAssist.SetShadowDepth(Button_App0, ShadowDepth.Depth1);
            ListView1.Children.Add(Button_App0);

            EventManager.RegisterClassHandler(typeof(Button), MouseUpEvent, new RoutedEventHandler(OnAppChangedMouseUp));

            PrimaryStackPanel1.Children.Add(HeaderStackPanel1);
            PrimaryStackPanel1.Children.Add(ListView1);
            PrimaryStackPanel1.Children.Add(Button1);
            // Card End

            PopupBox1.PopupContent = PrimaryStackPanel1;

            // Move PopupBox Attempt
            var part = PopupBox1.PopupContent as FrameworkElement;

            if (part == null)
            {
                Console.WriteLine("part = Null");
            }
            else
            {
                var parent = part.Parent as FrameworkElement;

                if (parent == null)
                {
                    Console.WriteLine("parent = Null");
                }
                else if (parent != null)
                {
                    parent.RenderTransform = new TranslateTransform(100, 0);
                }

                part.ClipToBounds = true;
            }

            // End

            This.Children.Add(PopupBox1);

            /////////////////////////////////////////////////////////////////////////////////
            This.m_CheckIfHandlerShouldExecute = false;
        }
Esempio n. 18
0
 public void SavePopup(string key, PopupBox popup)
 {
     _main.popupBoxList.Add(key, popup);
 }
Esempio n. 19
0
 public void ShowPopup(PopupBox popupBox)
 {
     popupBox.ShowDialog();
 }
Esempio n. 20
0
        private static void OnLoad(object sender, RoutedEventArgs e)
        {
            var This = (sender as TopAppBar_Message);

            if (This.m_CheckIfHandlerShouldExecute == false)
            {
                return;
            }

            /////////////////////////////////////////////////////////////////////////////////

            // PopupBox Button
            var PopupBox1 = new PopupBox()
            {
                Name = "TopAppBar_Notifications_PopupBox1",
                //Style = _this.FindResource("MaterialDesignToolPopupBox") as Style,
                //Width = 32, Height = 32,
                ClipToBounds               = true,
                StaysOpen                  = true,
                Margin                     = new Thickness(0),
                Padding                    = new Thickness(0),
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalAlignment          = VerticalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Center,
                Foreground                 = This.FindResource("MaterialDesignPaper") as Brush,
                PopupMode                  = PopupBoxPopupMode.Click,
                UnfurlOrientation          = Orientation.Horizontal,
                PlacementMode              = PopupBoxPlacementMode.BottomAndAlignRightEdges,
                FlowDirection              = FlowDirection.LeftToRight,
                UseLayoutRounding          = true,
            };

            EventManager.RegisterClassHandler(typeof(PopupBox), PopupBox.OpenedEvent, new RoutedEventHandler(OnMouseDown));

            var PackIcon1 = new PackIcon()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Width      = 18,
                Height     = 18,
                Kind       = PackIconKind.MessageProcessing,
                Foreground = This.FindResource("MaterialDesignPaper") as Brush,
            }; PopupBox1.ToggleContent = PackIcon1;

            ShadowAssist.SetShadowDepth(PopupBox1, ShadowDepth.Depth0);
            RippleAssist.SetRippleSizeMultiplier(PopupBox1, 0.5f);
            RippleAssist.SetClipToBounds(PopupBox1, false);
            RippleAssist.SetIsCentered(PopupBox1, true);
            RippleAssist.SetIsDisabled(PopupBox1, true);

            // PopupBox Button End

            // Card
            var PrimaryStackPanel1 = new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Orientation         = Orientation.Vertical,
            };

            var HeaderStackPanel1 = new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Orientation         = Orientation.Vertical,
                Background          = Brushes.WhiteSmoke,
            };

            var TextBlock1 = new TextBlock()
            {
                FontFamily    = new FontFamily("Roboto"),
                Padding       = new Thickness(96, 9, 96, 9),
                TextAlignment = TextAlignment.Center,
                FontSize      = 13,
                Opacity       = 0.75f,
                Text          = Application.Current.MainWindow.Title == "" ? "Messages" : Application.Current.MainWindow.Title,
                //Background = Brushes.Purple,
            };

            HeaderStackPanel1.Children.Add(TextBlock1);

            var Button1 = new Button()
            {
                Style   = This.FindResource("MaterialDesignToolButton") as Style,
                Height  = 16,
                Content = new PackIcon()
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Width   = 11, Height = 11,
                    Kind    = PackIconKind.ArrowCollapseDown,
                    Margin  = new Thickness(0, 0, 0, 0),
                    Padding = new Thickness(0, 0, 0, 0),
                },
                Padding    = new Thickness(0, 0, 0, 0),
                Margin     = new Thickness(0, 0, 0, 0),
                Background = Brushes.Gainsboro,
            };

            ShadowAssist.SetShadowEdges(Button1.Content as PackIcon, ShadowEdges.Top);
            ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1);
            ShadowAssist.SetShadowEdges(Button1, ShadowEdges.Top);
            ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1);
            RippleAssist.SetIsDisabled(Button1, false);
            RippleAssist.SetIsCentered(Button1, true);
            RippleAssist.SetClipToBounds(Button1, true);
            RippleAssist.SetRippleSizeMultiplier(Button1, 12.0f);

            var ListView1 = new StackPanel()
            {
                Orientation = Orientation.Vertical,
                Background  = Brushes.WhiteSmoke,
            };

            ListView1.Children.Add(new TextBlock()
            {
                FontSize = 11,
                Opacity  = 0.75f,
                Text     = "All caught up!",
                //Width = 80, Height = 40,
                TextAlignment       = TextAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Margin = new Thickness(0, 96, 0, 96),
            });

            ShadowAssist.SetShadowEdges(ListView1, ShadowEdges.Bottom);
            ShadowAssist.SetShadowDepth(ListView1, ShadowDepth.Depth1);
            ShadowAssist.SetDarken(ListView1, true);

            PrimaryStackPanel1.Children.Add(HeaderStackPanel1);
            PrimaryStackPanel1.Children.Add(ListView1);
            PrimaryStackPanel1.Children.Add(Button1);
            // Card End

            PopupBox1.PopupContent = PrimaryStackPanel1;

            This.Children.Add(PopupBox1);

            /////////////////////////////////////////////////////////////////////////////////
            This.m_CheckIfHandlerShouldExecute = false;
        }
Esempio n. 21
0
 private static void notify()
 {
     if (mode == "all")
     {
         StartOn = rssItemCount - 1;
         showPopUp = true;
     }
     if (mode == "notif" && showPopUp == false)
     {
         Notifier.notifyIcon.BalloonTipTitle = "No New Email";
         if (rssItemCount > 1)
         {
             Notifier.notifyIcon.BalloonTipText = "You have no new email.\r\nClick this baloon tip to view the last " + title.Length.ToString() + " notifications";
         }
         else if (rssItemCount == 1)
         {
             Notifier.notifyIcon.BalloonTipText = "You have no new email.\r\nClick this baloon tip to view the last notification";
         }
         else if (rssItemCount < 1)
         {
             Notifier.notifyIcon.BalloonTipText = "You have no new email.";
         }
         Notifier.notifyIcon.BalloonTipIcon = ToolTipIcon.Info;
         Notifier.notifyIcon.ShowBalloonTip(150);
     }
     else if (showPopUp == true)
     {
         PopupBox popupbox = new PopupBox(title, link, description, name, fullcount, StartOn);
     }
 }