Exemple #1
0
        /*
         * if you review the type hierarchy of IDEEvent, you will realize that
         * several subclasses exist that provide access to context information that
         * is specific to the event type.
         *
         * To access the context, you should check for the runtime type of the event
         * and cast it accordingly.
         *
         * As soon as I have some more time, I will implement the visitor pattern to
         * get rid of the casting. For now, this is recommended way to access the
         * contents.
         */
        private String process(IDEEvent e, out Completion vsEvent)
        {
            CommandEvent    ce    = e as CommandEvent;
            CompletionEvent compE = e as CompletionEvent;
            DocumentEvent   docE  = e as DocumentEvent;
            WindowEvent     winE  = e as WindowEvent;
            NavigationEvent navE  = e as NavigationEvent;


            String developerId = "";


            if (compE != null)
            {
                developerId = process(compE, out vsEvent);
            }
            //if (ce != null) developerId = process(ce, out vsEvent);
            //else if (docE != null) developerId = process(docE, out vsEvent);
            //else if (winE != null) developerId = process(winE, out vsEvent);
            //else if (navE != null) developerId = process(navE, out vsEvent);
            else
            {
                vsEvent = null; //developerId = processBasic(e, out vsEvent);
            }
            return(developerId);
        }
    protected override bool OnSrcEvent(Gst.Event evt)
    {
        NavigationEventType t = NavigationEvent.EventGetType(evt);

        if (t == NavigationEventType.MouseButtonPress)
        {
            double x, y;
            int    btn;

            if (NavigationEvent.ParseMouseButtonEvent(evt, out btn, out x, out y))
            {
                if (btn == 1)
                {
                    lastX = (int)x;
                    lastY = (int)y;
                }
            }
        }
        else if (t == NavigationEventType.MouseButtonRelease)
        {
            lastX = lastY = -1;
        }

        return(base.OnSrcEvent(evt));
    }
Exemple #3
0
        private void dgvSection_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (this.ImageView)
            {
                //  this.Stop = true;
                int             nIndex          = e.RowIndex;
                String          strFacility     = dgvSection.Rows[nIndex].Cells["FACILITY"].Value.ToString();
                String          strSection      = dgvSection.Rows[nIndex].Cells["SECTION"].Value.ToString();
                String          strDirection    = "";
                String          strBeginStation = "";
                NavigationEvent navigationEvent = null;

                String  strSelect = "SELECT SECTIONID,DIRECTION,BEGIN_STATION FROM SECTION_" + m_strNetworkID + " WHERE FACILITY='" + strFacility + "' AND SECTION='" + strSection + "'";
                DataSet ds        = DBMgr.ExecuteQuery(strSelect);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    String strID      = row["SECTIONID"].ToString();
                    int    nSectionID = int.Parse(strID);
                    if (nSectionID < 1000000)
                    {
                        strDirection    = row["DIRECTION"].ToString();
                        strBeginStation = row["BEGIN_STATION"].ToString();
                        navigationEvent = new NavigationEvent(strFacility, strDirection, double.Parse(strBeginStation));
                    }
                    else
                    {
                        navigationEvent = new NavigationEvent(strFacility, strSection);
                    }
                }

                m_event.issueEvent(navigationEvent);
            }
        }
Exemple #4
0
        public async Task OnNavigate_shouldFireEvents()
        {
            await TestNavigation(async (wpfbuild, wpfnav) =>
            {
                var a  = new A1();
                var pn = Path.Combine(Path.GetTempPath(), "MVMMAWe");

                var fslr            = false;
                wpfnav.OnFirstLoad += (o, e) => { fslr = true; };

                NavigationEvent nea = null;
                wpfnav.OnNavigate  += (o, e) => { nea = e; };

                EventHandler <FirstLoadEvent> ea = null;
                bool fl             = false;
                ea                  = (o, e) => { fl = true; wpfnav.OnFirstLoad -= ea; };
                wpfnav.OnFirstLoad += ea;
                wpfnav.Should().NotBeNull();
                SetUpRoute(wpfbuild, wpfnav);
                wpfnav.UseINavigable = true;

                wpfnav.IsHTMLLoaded.Should().BeFalse();
                await wpfnav.NavigateAsync(a);

                fl.Should().BeTrue();
                fslr.Should().BeTrue();
                nea.Should().NotBeNull();
                nea.OldViewModel.Should().BeNull();
                nea.NewViewModel.Should().Be(a);
            });
        }
Exemple #5
0
        private void NavigateTo(NavigationState nextState, NavigationEvent evt)
        {
            if (_currentState == nextState)
            {
                return;
            }

            var currentPresenter = _currentState?.GetPresenter();
            var nextPresenter    = nextState?.GetPresenter();

            _currentState = null;

            if (nextPresenter != null)
            {
                _currentState           = nextState;
                nextPresenter.Navigator = this;
                nextPresenter.Display(evt);
            }

            if (currentPresenter != null)
            {
                currentPresenter.Dismiss();
                currentPresenter.Navigator = null;
            }
        }
Exemple #6
0
 private void MMessageBus_NavigationDisableHandler(object sender, NavigationEvent e)
 {
     if (Widget != null)
     {
         Widget.Enabled = false;
     }
 }
 // Fixme: This event only is raised at the moment when the state is created but it will be better
 // if it is only related with the open operation itself.
 void HandleNavigation(NavigationEvent e)
 {
     if (e.Name == ProjectAnalysisState.NAME)
     {
         ViewModel.ShowWarningLimitation.Execute();
     }
 }
Exemple #8
0
 /// <summary>
 /// Broadcasts a navigation event to all navigation progress listeners that were registered with the navigation factory.
 /// </summary>
 /// <param name="navigationEvent">The navigation event.</param>
 public void ReportProgress(NavigationEvent navigationEvent)
 {
     ((INavigationEvent)navigationEvent).Request = this;
     foreach (var listener in progressListeners)
     {
         listener.UpdateProgress(navigationEvent);
     }
 }
Exemple #9
0
        public BeaconScanForIBeacon()
        {
            _event = new NavigationEvent();
            var appContext = Android.App.Application.Context;

            this._manager = (BluetoothManager)appContext.GetSystemService("bluetooth");
            this._adapter = this._manager.Adapter;
        }
 public BeaconScan()
 {
     _event = new NavigationEvent();
     this._manager.DiscoveredPeripheral += this.DiscoveredPeripheral;
     this._manager.UpdatedState         += this.UpdatedState;
     Console.WriteLine("In BeaconScan constructor: CBCentralManager stata =" +
                       this._manager.State);
 }
        public void Equality_Default()
        {
            var a = new NavigationEvent();
            var b = new NavigationEvent();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void DefaultValues()
        {
            var sut = new NavigationEvent();

            Assert.AreEqual(Names.UnknownGeneral, sut.Target);
            Assert.AreEqual(Names.UnknownGeneral, sut.Location);
            Assert.AreEqual(NavigationType.Unknown, sut.TypeOfNavigation);
        }
Exemple #13
0
 public WaypointClient()
 {
     _event = new NavigationEvent();
     Utility._lbeaconScan    = DependencyService.Get <LBeaconScan>();
     _beaconScanEventHandler = new EventHandler(HandleBeaconScan);
     Utility._lbeaconScan._event._eventHandler += _beaconScanEventHandler;
     _waypointBeaconsList = new List <WaypointBeaconsMapping>();
     rssiOption           = 0;
 }
Exemple #14
0
        public void NavigateTo(NavigationEvent evt)
        {
            if (_currentState == null)
            {
                throw new ArgumentException("State not initialised, must initialise navigator with starting state", nameof(NavigationState));
            }

            NavigateTo(_currentState.Next(evt), evt);
        }
Exemple #15
0
        private String process(NavigationEvent ne, out Event cmd)
        {
            //writer.WriteLine("found a CommandEvent (id: " + ce.CommandId + ")");
            cmd = new NavCmd(ne.TypeOfNavigation.ToString());
            ((NavCmd)cmd).target = ne.Target.Identifier;
            cmd.triggeredAt      = ne.TriggeredAt;

            return(ne.IDESessionUUID);
        }
        public void Equality_DifferentTarget()
        {
            var a = new NavigationEvent {
                Target = Names.General("A")
            };
            var b = new NavigationEvent();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void Equality_BaseClassIsCalled()
        {
            var a = new NavigationEvent {
                IDESessionUUID = "a"
            };
            var b = new NavigationEvent();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void Equality_DifferentNavigationType()
        {
            var a = new NavigationEvent {
                TypeOfNavigation = NavigationType.Click
            };
            var b = new NavigationEvent();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
Exemple #19
0
            internal static unsafe InputEvent Invoke(NavigationEvent Event)
            {
                long *p = stackalloc long[] { 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L };
                byte *b = (byte *)p;

                *((NavigationEvent *)(b + 0)) = Event;
                Main.GetProcessEvent(WidgetBlueprintLibrary.DefaultObject, GetInputEventFromNavigationEvent_ptr, new IntPtr(p));;
                return(*((InputEvent *)(b + 32)));
            }
        }
Exemple #20
0
        public void DeserializeNavigationEvent()
        {
            /* GIVEN */
            var deserialized = new NavigationEvent();

            /* WHEN */
            deserialized.Deserialize(serializedEvent);

            /* THEN */
            TestCommonAttributes(deserialized);
        }
Exemple #21
0
        /// <summary>
        /// Handles when navigation event has been thrown.
        /// </summary>
        /// <param name="evt">Evt.</param>
        void HandleNavigationEvent(NavigationEvent evt)
        {
            string NextEvent = evt.Name;

            if (!string.IsNullOrEmpty(currentState) && (NextEvent != currentState))
            {
                SaveTimer();
            }
            StateTimer.Start();
            currentState = NextEvent;
        }
        public IBeaconClient()
        {
            Console.WriteLine("In Ibeacon Type");

            _event = new NavigationEvent();

            _beaconScanEventHandler = new EventHandler(HandleBeaconScan);
            Utility._ibeaconScan._event._eventHandler += _beaconScanEventHandler;
            _waypointBeaconsList = new List <WaypointBeaconsMapping>();
            rssiOption           = 0;
        }
Exemple #23
0
        public override NavigationState Next(NavigationEvent evt)
        {
            switch (evt)
            {
            case StartUpEvent startUpEvent:
                return(new WelcomeState(PresenterFactory));

            default:
                return(this);
            }
        }
        protected override void OnDisplay(NavigationEvent evt)
        {
            if (evt is StartUpEvent startUpEvent)
            {
                View.WelcomeText = startUpEvent.Introduction;
            }

            View.WelcomeOk    += WelcomeViewOnWelcomeOk;
            View.CloseRequest += WelcomeViewCloseClicked;
            View.Show();
        }
Exemple #25
0
        protected override void OnDisplay(NavigationEvent evt)
        {
            // Get all the state from the service, rather than directly from the event.

            View.WelcomeText = _applicationData.GetIntroductionText();

            // Register the view handlers to presenter methods.

            View.WelcomeOk    += WelcomeViewOnWelcomeOk;
            View.CloseRequest += WelcomeViewCloseClicked;
            View.Show();
        }
Exemple #26
0
        public NavigationModule(string navigationGraphName,
                                Guid destinationRegionID,
                                Guid destinationWaypointID)
        {
            _event = new NavigationEvent();

            _navigationGraphName   = navigationGraphName;
            _destinationRegionID   = destinationRegionID;
            _destinationWaypointID = destinationWaypointID;

            ConstructSession();
        }
        public void SettingValues()
        {
            var sut = new NavigationEvent
            {
                Target           = Names.General("A"),
                Location         = Names.General("B"),
                TypeOfNavigation = NavigationType.Click
            };

            Assert.AreEqual(Names.General("A"), sut.Target);
            Assert.AreEqual(Names.General("B"), sut.Location);
            Assert.AreEqual(NavigationType.Click, sut.TypeOfNavigation);
        }
Exemple #28
0
        private void OnNavigateFired(object sender, NavigationEvent e)
        {
            OnNavigate?.Invoke(this, e);

            if (!IsDebug)
            {
                return;
            }

            var modern = _WpfDoubleBrowserNavigator.HTMLWindow as IModernWebBrowserWindow;

            modern?.RegisterContextMenuItem(GetMenu())?.RegisterContextMenuItem(GetAbout());
        }
        public IBeaconClient()
        {
            Console.WriteLine("In Ibeacon Type");

            _event = new NavigationEvent();
            Utility._ibeaconScan    = DependencyService.Get <IBeaconScan>();
            _bufferLock             = new object();
            _beaconScanEventHandler = new EventHandler(HandleBeaconScan);
            Utility._ibeaconScan._event._eventHandler += _beaconScanEventHandler;
            _waypointBeaconsList = new List <WaypointBeaconsMapping>();
            rssiOption           = 0;

            watch.Start();
        }
        public override NavigationState Next(NavigationEvent evt)
        {
            switch (evt)
            {
            case StartUpEvent startUpEvent:

                _appState.SetIntroductionText(startUpEvent.Introduction);

                return(new WelcomeState(PresenterFactory));

            default:
                return(this);
            }
        }
Exemple #31
0
 private void Controller_Monitor(System.Object controller, NavigationEvent args)
 {
     switch (args.navEvent)
     {
         case NavEventType.NewGoal:
             // Something else has taken over control.
             mFailed = true;
             break;
         case NavEventType.NavFailed:
             mFailed = true;
             break;
         case NavEventType.NavSuspended:
             mFailed = true;
             break;
     }
 }
 void wpfnav_OnNavigate(object sender, NavigationEvent e)
 {
 }