コード例 #1
0
ファイル: DataEventBase.cs プロジェクト: Duke-Jones/ED-IBE
 protected virtual void OnLocationInfo(LocationInfoEventArgs e)
 {
     EventHandler<LocationInfoEventArgs> myEvent = LocationInfo;
     if (myEvent != null)
     {
         myEvent(this, e);
     }
 }
コード例 #2
0
ファイル: DataEventBase.cs プロジェクト: mlof/ED-IBE
        protected virtual void OnLocationInfo(LocationInfoEventArgs e)
        {
            EventHandler <LocationInfoEventArgs> myEvent = LocationInfo;

            if (myEvent != null)
            {
                myEvent(this, e);
            }
        }
コード例 #3
0
        internal void RaiseTestEvent()
        {
            try
            {
                String newSystem;

                if (Program.actualCondition.System == "Eravate")
                {
                    newSystem = "Pai Huldr";
                }
                else
                {
                    newSystem = "Eravate";
                }

                Program.actualCondition.System   = newSystem;
                Program.actualCondition.Location = "";

                var LI = new LocationInfoEventArgs()
                {
                    System   = Program.actualCondition.System,
                    Location = Program.actualCondition.Location
                };
                LocationInfo.Raise(this, LI);


                var EA = new LocationChangedEventArgs()
                {
                    System      = Program.actualCondition.System,
                    Location    = Program.actualCondition.Location,
                    OldSystem   = Program.actualCondition.System,
                    OldLocation = Program.actualCondition.Location,
                    Changed     = enLogEvents.Jump | enLogEvents.System
                };
                LocationChanged.Raise(this, EA);
            }
            catch (Exception ex)
            {
                throw new Exception("Error in RaiseEvent", ex);
            }
        }
コード例 #4
0
ファイル: EDLogfileScanner.cs プロジェクト: Duke-Jones/ED-IBE
        internal void RaiseTestEvent()
        {

            try
            {
                String newSystem;

                if (Program.actualCondition.System == "Eravate")
                    newSystem = "Pai Huldr";
                else
                    newSystem = "Eravate";

                Program.actualCondition.System      = newSystem;
                Program.actualCondition.Location    = "";

                var LI = new LocationInfoEventArgs() { System        = Program.actualCondition.System,  
                                                       Location      = Program.actualCondition.Location};
                LocationInfo.Raise(this, LI);


                var EA = new LocationChangedEventArgs() { System        = Program.actualCondition.System,  
                                                          Location      = Program.actualCondition.Location,
                                                          OldSystem     = Program.actualCondition.System,  
                                                          OldLocation   = Program.actualCondition.Location,
                                                          Changed       = enLogEvents.Jump | enLogEvents.System};
                LocationChanged.Raise(this, EA);
            }
            catch (Exception ex)
            {
                throw new Exception("Error in RaiseEvent", ex);
            }
        }
コード例 #5
0
ファイル: EDLogfileScanner.cs プロジェクト: Duke-Jones/ED-IBE
        /// <summary>
        /// processing the collected informations
        /// </summary>
        /// <param name="LoggedEvents"></param>
        private void processingLocationInfo(List<LogEvent> LoggedEvents)
        {
            //Boolean SystemHasChanged   = false;
            //Boolean LocationHasChanged = false;
            String OldSystemString;
            String OldLocationString;
            String foundSystemString;
            String foundLocationString;
            enLogEvents EventFlags = enLogEvents.None;
            Point3Dbl usePosition = null;

            try
            {
                if(LoggedEvents.Count() > 0)
                { 
                    // order by date
                    LoggedEvents = LoggedEvents.OrderBy(x => x.Time).ToList();

                    // scan sequence
                    foreach (LogEvent Event in LoggedEvents)
                    {
                        OldSystemString     = Program.actualCondition.System;
                        OldLocationString   = Program.actualCondition.Location;
                        EventFlags          = enLogEvents.None;
                        usePosition         = null;
                        foundSystemString   = "";
                        foundLocationString = "";

                        switch (Event.EventType)
                        {
                            case enLogEvents.Jump:
                                // after a jump we are no longer on a station

                                if(!m_InitialJumpFound)
                                { 
                                    // it's only the "startjump" of ED, not really a jump
                                    m_InitialJumpFound = true;
                                    Program.DBCon.setIniValue(DB_GROUPNAME, "InitialJumpFound", m_InitialJumpFound.ToString());
                                }
                                else
                                { 
                                    if(!String.IsNullOrEmpty(OldLocationString))
                                    { 
                                        EventFlags |= enLogEvents.Location;
                                        foundLocationString  = Event.Value;
                                    }
                                    
                                    EventFlags |= enLogEvents.Jump;

                                    Debug.Print("log - scanning : jump found");
                                }
                                break;

                            case enLogEvents.System:
                                // a new system is everytime valid, check if the system has changed
                                if((Event.Value != "") && (!Event.Value.Equals(OldSystemString, StringComparison.InvariantCultureIgnoreCase)))
                                { 
                                    EventFlags |= enLogEvents.System;
                                    foundSystemString  = Event.Value;
                                    usePosition = Event.Position;

                                    // after a jump we are no longer on a station
                                    if(!String.IsNullOrEmpty(OldLocationString))
                                    { 
                                        EventFlags |= enLogEvents.Location;
                                        foundLocationString  = "";
                                    }
                                    Debug.Print("log - scanning : system found : " + Event.Value);
                                }
                                break;

                            case enLogEvents.Location:
                                // a new station is everytime valid, check if the station has changed
                                if((Event.Value != "") && (!Event.Value.Equals(OldLocationString, StringComparison.InvariantCultureIgnoreCase)))
                                { 
                                    EventFlags |= enLogEvents.Location;
                                    foundLocationString  = Event.Value;
                                }
                                Debug.Print("log - scanning : location found : " + Event.Value);
                                break;

                        }    

                        if(EventFlags != enLogEvents.None)
                        {
                            // something has changed -> fire events

                            var LI = new LocationInfoEventArgs() { System        = foundSystemString,  
                                                                   Location      = foundLocationString,
                                                                   Position      = usePosition};
                            LocationInfo.Raise(this, LI);


                            var EA = new LocationChangedEventArgs() { System        = foundSystemString,  
                                                                      Location      = foundLocationString,
                                                                      OldSystem     = OldSystemString,  
                                                                      OldLocation   = OldLocationString,
                                                                      Changed       = EventFlags,
                                                                      Position      = usePosition, 
                                                                      TimeStamp     = Event.Time};
                            LocationChanged.Raise(this, EA);
                        }

                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error while processing location info", ex);
            }
        }
コード例 #6
0
        /// <summary>
        /// processing the collected informations
        /// </summary>
        /// <param name="LoggedEvents"></param>
        private void processingLocationInfo(List <LogEvent> LoggedEvents)
        {
            //Boolean SystemHasChanged   = false;
            //Boolean LocationHasChanged = false;
            String      OldSystemString;
            String      OldLocationString;
            String      foundSystemString;
            String      foundLocationString;
            enLogEvents EventFlags  = enLogEvents.None;
            Point3Dbl   usePosition = null;

            try
            {
                if (LoggedEvents.Count() > 0)
                {
                    // order by date
                    LoggedEvents = LoggedEvents.OrderBy(x => x.Time).ToList();

                    // scan sequence
                    foreach (LogEvent Event in LoggedEvents)
                    {
                        OldSystemString     = Program.actualCondition.System;
                        OldLocationString   = Program.actualCondition.Location;
                        EventFlags          = enLogEvents.None;
                        usePosition         = null;
                        foundSystemString   = "";
                        foundLocationString = "";

                        switch (Event.EventType)
                        {
                        case enLogEvents.Jump:
                            // after a jump we are no longer on a station

                            if (!m_InitialJumpFound)
                            {
                                // it's only the "startjump" of ED, not really a jump
                                m_InitialJumpFound = true;
                                Program.DBCon.setIniValue(DB_GROUPNAME, "InitialJumpFound", m_InitialJumpFound.ToString());
                            }
                            else
                            {
                                if (!String.IsNullOrEmpty(OldLocationString))
                                {
                                    EventFlags         |= enLogEvents.Location;
                                    foundLocationString = Event.Value;
                                }

                                EventFlags |= enLogEvents.Jump;

                                Debug.Print("log - scanning : jump found");
                            }
                            break;

                        case enLogEvents.System:
                            // a new system is everytime valid, check if the system has changed
                            if ((Event.Value != "") && (!Event.Value.Equals(OldSystemString, StringComparison.InvariantCultureIgnoreCase)))
                            {
                                EventFlags       |= enLogEvents.System;
                                foundSystemString = Event.Value;
                                usePosition       = Event.Position;

                                // after a jump we are no longer on a station
                                if (!String.IsNullOrEmpty(OldLocationString))
                                {
                                    EventFlags         |= enLogEvents.Location;
                                    foundLocationString = "";
                                }
                                Debug.Print("log - scanning : system found : " + Event.Value);
                            }
                            break;

                        case enLogEvents.Location:
                            // a new station is everytime valid, check if the station has changed
                            if ((Event.Value != "") && (!Event.Value.Equals(OldLocationString, StringComparison.InvariantCultureIgnoreCase)))
                            {
                                EventFlags         |= enLogEvents.Location;
                                foundLocationString = Event.Value;
                            }
                            Debug.Print("log - scanning : location found : " + Event.Value);
                            break;
                        }

                        if (EventFlags != enLogEvents.None)
                        {
                            // something has changed -> fire events

                            var LI = new LocationInfoEventArgs()
                            {
                                System   = foundSystemString,
                                Location = foundLocationString,
                                Position = usePosition
                            };
                            LocationInfo.Raise(this, LI);


                            var EA = new LocationChangedEventArgs()
                            {
                                System      = foundSystemString,
                                Location    = foundLocationString,
                                OldSystem   = OldSystemString,
                                OldLocation = OldLocationString,
                                Changed     = EventFlags,
                                Position    = usePosition,
                                TimeStamp   = Event.Time
                            };
                            LocationChanged.Raise(this, EA);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error while processing location info", ex);
            }
        }
コード例 #7
0
        /// <summary>
        /// confirms the last retrieved location
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Confirm()
        {
            DialogResult MBResult           = System.Windows.Forms.DialogResult.OK;
            String OldSystemString          = "";
            String OldLocationString        = "";
            enExternalDataEvents ChangedIs  = enExternalDataEvents.None;

            try
            {
                if(!Program.actualCondition.System.Equals(m_RetrievedSystem))
                {
                    MBResult = MessageBox.Show("The retrieved system do not correspond to the system from the logfile!\n" +
                                               "Confirm even so ?", "Unexpected system",
                                               MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                }

                if(MBResult == System.Windows.Forms.DialogResult.OK)
                {
                    if(!Program.actualCondition.System.Equals(m_RetrievedSystem) ||
                       !Program.actualCondition.Location.Equals(m_RetrievedStation))
                    {
                        OldSystemString     = Program.actualCondition.System;
                        OldLocationString   = Program.actualCondition.Location;

                        ChangedIs = enExternalDataEvents.Landed;

                        if(!Program.actualCondition.System.Equals(m_RetrievedSystem))
                            ChangedIs |= enExternalDataEvents.System;

                        if(!Program.actualCondition.Location.Equals(m_RetrievedStation))
                            ChangedIs |= enExternalDataEvents.Location;
                    }

                    Program.actualCondition.System   = m_RetrievedSystem;
                    Program.actualCondition.Location = m_RetrievedStation;

                    if(ChangedIs != enExternalDataEvents.None)
                    {
                        // something has changed -> fire events
                        var LI = new LocationInfoEventArgs() { System        = Program.actualCondition.System,
                                                               Location      = Program.actualCondition.Location};
                        LocationInfo.Raise(this, LI);

                        var EA = new LocationChangedEventArgs() { System        = Program.actualCondition.System,
                                                                  Location      = Program.actualCondition.Location,
                                                                  OldSystem     = OldSystemString,
                                                                  OldLocation   = OldLocationString,
                                                                  Changed       = ChangedIs};
                        ExternalDataEvent.Raise(this, EA);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error while confirming retrieved location", ex);
            }
        }