public void ThenTheNotificationBarShouldSay(string message)
        {
            var bar = NotificationBar.Get(executionContext.Driver);

            bar.WithControl(NotificationBar.Controls.Text)
            .GetText().Should().Be(message);
        }
Esempio n. 2
0
        public static void UpdateInternalNofinication()
        {
            NotificationBar clipboardnotification = new NotificationBar();

            clipboardnotification.HeadlineText    = "剪贴板感知";
            clipboardnotification.DescriptionText = "检测到您复制了 " + ClipboardText + " 。";
            clipboardnotification.Button1.Content = "查词";
            clipboardnotification.Button2.Content = "仅黏贴";
            clipboardnotification.Button3.Content = "取消";
            clipboardnotification.Button1.Click  += (s, e) =>
            {
                AppViewModel.UpdateTextBoxAndQueryWord(ClipboardText);
                clipboardnotification.IsOpen = false;
            };
            clipboardnotification.Button2.Click += (s, e) =>
            {
                AppViewModel.UpdateTextBoxOnly(ClipboardText);
                clipboardnotification.IsOpen = false;
            };
            clipboardnotification.Button3.Click += (s, e) =>
            {
                clipboardnotification.IsOpen = false;
            };
            MainPage.Add_Notification(clipboardnotification);
        }
        public override void Initialize()
        {
            Viewport viewport = ((ContentSystem)world.SystemManager.GetSystem<ContentSystem>()[0]).GetViewport();

            originalWidth = (int)((float)viewport.Width * 0.5f);

            //Notification Bar
            notificationWindow = new Window(manager);
            notificationWindow.Init();
            notificationWindow.Text = "Notification Bar";
            notificationWindow.Height = 110;
            notificationWindow.Width = originalWidth;
            notificationWindow.Visible = true;
            notificationWindow.Top = viewport.Height - notificationWindow.Height;
            notificationWindow.Left = viewport.Width/2 - originalWidth/2;
            notificationWindow.CloseButtonVisible = false;
            notificationWindow.AutoScroll = true;
            notificationWindow.Resizable = true;
            notificationWindow.Click += new TomShane.Neoforce.Controls.EventHandler(OnWindowClickBehavior);
            notificationWindow.IconVisible = false;
            manager.Add(notificationWindow);

            NotificationBar data = new NotificationBar(m_device, m_content, originalWidth-32, 25);

            notificationBar = new NotificationBarContainer(manager, notificationWindow, data);
            notificationBar.Init();
            notificationBar.Width = originalWidth-32;// tilemap.tilemapImage.Width;
            notificationBar.Height = 160;// tilemap.tilemapImage.Height;
            notificationBar.Parent = notificationWindow;
            notificationBar.CanFocus = false;
            notificationBar.MouseOver += new TomShane.Neoforce.Controls.MouseEventHandler(OnGainFocus);
            notificationBar.MouseOut += new TomShane.Neoforce.Controls.MouseEventHandler(OnLoseFocus);
        }
Esempio n. 4
0
 private void UpdateGUI(List <List <Slot> > result)
 {
     _raw         = result;
     _cyclicIndex = new CyclicIndex();
     if (result == null || result.Count == 0)
     {
         if (_inputSlots.NoSlotIsChosen())
         {
             _outputTimetables.SetState(TimetableList.NoSlotsIsChosen);
             AutoCloseNotificationBar.Show("No subject selected.");
         }
         else
         {
             _outputTimetables.SetState(TimetableList.NoPossibleCombination);
             NotificationBar.Show("No possible timetable found.", "Tell me why", () =>
             {
                 DialogBox.Show("Why no possible combination?", new ClashFinder(_subjectModels, _permutator).Message);
             }, false);
         }
         ToolBoxPanel.Visibility = Visibility.Hidden;
         _cyclicIndex.Reset();
     }
     else
     {
         _outputTimetables.SetState(new TimetableList(result));
         ToolBoxPanel.Visibility   = Visibility.Visible;
         _cyclicIndex.MaxValue     = result.Count - 1;
         _cyclicIndex.CurrentValue = 0;
         AutoCloseNotificationBar.Show(result.Count + " possible timetables found.");
     }
     TimetableViewer.Initialize(_cyclicIndex);
     CyclicIndexView.DataContext = new CyclicIndexVM(_cyclicIndex);
 }
 public static void Remove_Notification(NotificationBar notificationBar)
 {
     foreach (var item in Current.NotificationArea.Children)
     {
         if (item == notificationBar)
         {
             Current.NotificationArea.Children.Remove(item);
         }
     }
 }
Esempio n. 6
0
        public void NotifyMessageTest()
        {
            Mock <NotificationBar> mock = new Mock <NotificationBar>();

            mock.Protected().Setup("NotifyStateChanged").Callback(() => { });
            NotificationBar bar = mock.Object;

            bar.NotifyMessage(NotificationKind.ErrorNotification, "test");
            Assert.AreEqual("test", bar.Message);
            Assert.IsTrue(bar.AlertVisible);
        }
Esempio n. 7
0
        public void DoesInitializeNotificationMessageProviderTest()
        {
            NotificationBar bar = new NotificationBar();

            typeof(NotificationBar).GetMethod("OnInitialized", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(bar, null);
            object value = typeof(NotificationMessageProvider)
                           .GetField("notificationProvider", BindingFlags.Static | BindingFlags.NonPublic)
                           .GetValue(null);

            Assert.AreSame(bar, value);
        }
Esempio n. 8
0
        public void ResetNotificationTest()
        {
            Mock <NotificationBar> mock = new Mock <NotificationBar>();

            mock.Protected().Setup("NotifyStateChanged").Callback(() => { });
            NotificationBar bar = mock.Object;

            bar.Message      = "test";
            bar.AlertVisible = true;
            bar.ResetNotification();
            Assert.IsTrue(string.IsNullOrEmpty(bar.Message));
            Assert.IsFalse(bar.AlertVisible);
        }
    private void OnCoordinatorStateChange(RemoteRenderingCoordinator.RemoteRenderingState state)
    {
        if (state == RemoteRenderingCoordinator.RemoteRenderingState.RuntimeConnected)
        {
            TryFindBaseObject();

            if (baseObject != null)
            {
                if (!viewEnabled)
                {
                    SetViewEnabled(true);
                }
            }
            else
            {
                // Expected when the functionality hasn't been implmented yet
                NotificationBar.Message($"View disabled: No object of type {typeof(T)} found.");
            }
        }
    }
Esempio n. 10
0
        public Notification(Panel Parent, string Message, string EnterLabelText, Brush BackgroundBrush)
        {
            NB = new NotificationBar();
            P  = Parent;
            NB.BackgroundBrush = BackgroundBrush;
            NB.MaximizedMargin = new Thickness(0, 0, 0, 0);

            if (!string.IsNullOrEmpty(EnterLabelText))
            {
                NB.VisibleEnterLabel = true;
                NB.EnterLabelText    = EnterLabelText;
            }

            NB.HorizontalAlignment = HorizontalAlignment.Stretch;
            NB.VerticalAlignment   = VerticalAlignment.Top;
            NB.Margin = new Thickness(0, -NB.Height, 0, 0);
            P.Children.Add(NB);

            NB.Message = Message;
            NB.Click  += NB_Click;
        }
 private void OnDestroy()
 {
     instance = null;
 }
Esempio n. 12
0
 public World()
 {
     EntitySystem     = new EntitySystem();
     _inputSystem     = GameInstance.GetService <InputSystem>();
     _notificationBar = GameInstance.GetService <NotificationBar>();
 }
 public static void Add_Notification(NotificationBar notificationBar)
 {
     Current.NotificationArea.Children.Add(notificationBar);
 }
Esempio n. 14
0
 /// <summary>
 /// Opens the window to create a new EventScheduler for the selected crowd.
 /// </summary>
 private void CreateEventScheduler(ISmartCrowdCriteria criteria)
 {
     EventSchedulerWindow schedulerSetup = new EventSchedulerWindow();
     mainArea = schedulerSetup;
     notificationBar = new NotificationBar("You have selected a crowd. See the game view for the contained objects. You can now create an EventScheduler for the crowd or cancel.");
     MouseHandler.GetInstance().DeregisterDragEvents(crowdRectangleSelectAction);
     MouseHandler.GetInstance().DeregisterDragEvents(drawRectangleAction);
     ActionBar.AddButton("Set And Save Scheduler", () =>
     {
         Debug.Log("Exectuting Set and save");
         CrowdGenerator.Instance.GenerateCrowd(criteria, crowdStatic, schedulerSetup.ToEventCollection(true));
         Reset();
     });
     ActionBar.AddButton("Set Scheduler", () =>
     {
         CrowdGenerator.Instance.GenerateCrowd(criteria, crowdStatic, schedulerSetup.ToEventCollection(false));
         Reset();
     });
 }
Esempio n. 15
0
 /// <summary>
 /// Starts the crowd selection logic, i.e. selecting a new crowd in the scene.
 /// </summary>
 private void StartCrowdSelection()
 {
     notificationBar = new NotificationBar("Select a crowd by creating a rectangle in the scene or selecting the individual objects.");
     actionBars.Add(selectCrowdBar);
     MouseHandler.GetInstance().RegisterDragEvents(drawRectangleAction);
     MouseHandler.GetInstance().RegisterDragEvents(crowdRectangleSelectAction);
 }
Esempio n. 16
0
 /// <summary>
 /// Sets the current NotificationBar to the given bar.
 /// </summary>
 public void SetNotificationBar(NotificationBar bar)
 {
     this.notificationBar = bar;
 }
 private void Awake()
 {
     instance = this;
 }
Esempio n. 18
0
        /// <summary>
        /// In HTML konvertieren
        /// </summary>
        /// <returns>Das Control als HTML</returns>
        public override IHtmlNode ToHtml()
        {
            var classes = new List <string>();

            classes.Add(Class);
            classes.Add("navbar");
            //classes.Add("navbar-expand-xl");

            if (Dark)
            {
                classes.Add("navbar-dark");
            }
            else
            {
                classes.Add("navbar-light");
            }

            switch (Fixed)
            {
            case FixedTypes.Top:
                classes.Add("fixed-top");
                break;

            case FixedTypes.Bottom:
                classes.Add("fixed-bottom");
                break;
            }

            switch (Expand)
            {
            case ExpandTypes.ExtraLarge:
                classes.Add("navbar-expand-xl");
                break;

            case ExpandTypes.Large:
                classes.Add("navbar-expand-lg");
                break;

            case ExpandTypes.Medium:
                classes.Add("navbar-expand-md");
                break;

            case ExpandTypes.Small:
                classes.Add("navbar-expand-sm");
                break;
            }

            if (Sticky)
            {
                classes.Add("sticky-top");
            }

            var html = new HtmlElementNav()
            {
                Class = string.Join(" ", classes.Where(x => !string.IsNullOrWhiteSpace(x)))
            };

            html.Elements.Add(HamburgerMenu.ToHtml());
            html.Elements.Add(ToolBar.ToHtml());
            html.Elements.Add(new HtmlElementSpan(new HtmlText(Title))
            {
                Class = "navbar-text"
            });
            html.Elements.Add(NotificationBar.ToHtml());

            return(html);
        }
Esempio n. 19
0
    /// <summary>
    /// Create a new CrowdAuthoringEditor with the given line renderer.
    /// </summary>
    /// <param name="renderer">The line renderer for rendering lines in the main window.</param>
    public CrowdAuthoringEditor(AbstractLineRenderer renderer)
    {
        try
        {
            highlighter = Highlighter.Instance;

            objectSidebar = new Sidebar<SmartObject>(true, ObjectContentString);
            objectSidebar.RegisterLeftClickAction(highlighter.HighlightAfterUnhighlight);
            objectSidebar.RegisterLeftClickAction(OnParticipantDragStart);
            eventSidebar = new Sidebar<EventStub>(true, (EventStub e) => new GUIContent(e.Name));
            eventSidebar.RegisterLeftClickAction(OnEventDragStart);
            eventSidebar.allObjects.UnionWith(AllEvents());
            PeriodicMethodCaller.GetInstance().StartCallPeriodically(FindAllSmartObjects, 1.0f);

            actionBars = new List<ActionBar>();
            notificationBar = new NotificationBar("This is the main view, where you can see all your upcoming events");

            defaultBar = DefaultBar();
            selectCrowdBar = SelectCrowdBar();
            optionsBar = OptionsBar();

            actionBars.Add(defaultBar);

            mainArea = mainWindow = new MainWindow(AuthoredEventManager.Instance, this, renderer);
            mainWindow.RegisterLeftClickAction(highlighter.HighlightAfterUnhighlight);

            positionSelectAction = new MouseHandler.ClickActions((RaycastHit hit) => { }, TryCreateWaypoint);
            MouseHandler.GetInstance().RegisterClickEvents(positionSelectAction);

            RectanglePainter painter = RectanglePainter.GetWithColor(Color.blue);
            drawRectangleAction = new MouseHandler.DragActions(painter.StartPainting, painter.ContinuePainting, (Vector3 pos) => painter.StopPainting());
            crowdRectangleSelectAction = new MouseHandler.DragActions(OnSelectionStart, (Vector3 pos) => { }, OnSelectionStopped);
            EventCollectionManager.Instance.SetAllCollections(EventCollectionSerializer.Instance.Load());

        }
        catch (Exception e)
        {
            Debug.Log(e.StackTrace);
            Debug.Log(e.Message);
            Debug.Log(e.Source);
            mustClose = true;
        }
    }
 public NotificationBarContainer(Manager p_manager, Window p_parent, NotificationBar p_bar)
     : base(p_manager)
 {
     m_bar = p_bar;
     m_parentWindow = p_parent;
 }
Esempio n. 21
0
 /// <summary>
 /// Resets the current selection. As there is no information in which state the GUI was previously, must do a full set
 /// of reset action, even if maybe not all are necessary.
 /// </summary>
 public void Reset()
 {
     notificationBar = new NotificationBar("This is the main view, where you can see all your upcoming events");
     actionBars.Clear();
     actionBars.Add(defaultBar);
     MouseHandler.GetInstance().DeregisterDragEvents(drawRectangleAction);
     MouseHandler.GetInstance().DeregisterDragEvents(crowdRectangleSelectAction);
     selectCrowdBar.RemoveButton("Set Scheduler");
     selectCrowdBar.RemoveButton("Set And Save Scheduler");
     mainArea = mainWindow;
 }