예제 #1
0
        /// <summary>
        /// Creates a new instance configured to output to the given writer.
        /// </summary>
        /// <param name="eventSource">
        /// The event source to listen to.
        /// </param>
        /// <param name="writer">The TextWriter where to send the output.</param>
        /// <param name="baseTime">The UTC time when the build started.</param>
        /// <param name="warningMapper">
        /// An optional delegate that is used to map warnings into errors or to suppress warnings.
        /// </param>
        /// <param name="logErrors">
        /// When true, will log errors.
        /// </param>
        /// <param name="logWarnings">
        /// When true, will log warnings.
        /// </param>
        /// <param name="pathTranslator">
        /// If specified, translates paths from one root to another
        /// </param>
        /// <param name="timeDisplay">
        /// The kind of time prefix to apply to each chunk of output.
        /// </param>
        public ErrorAndWarningEventListener(
            Events eventSource,
            TextWriter writer,
            DateTime baseTime,
            bool logErrors,
            bool logWarnings,
            WarningMapper warningMapper   = null,
            PathTranslator pathTranslator = null,
            TimeDisplay timeDisplay       = TimeDisplay.None)
            : base(
                eventSource,
                writer,
                baseTime,
                warningMapper,
                logWarnings ? EventLevel.Warning :

                // The error listener must listen to both warnings and errors, since warnings can be promoted
                // to errors. When that happens, they need to trigger the error event listener to ensure
                // they get logged in the error log file
                (EventLevel.Error | EventLevel.Warning),
                pathTranslator: pathTranslator,
                timeDisplay: timeDisplay)
        {
            Contract.Requires(eventSource != null);
            Contract.Requires(writer != null);

            m_logErrors   = logErrors;
            m_logWarnings = logWarnings;
        }
예제 #2
0
    private void InCardSelect()
    {
        float  turnBeginTime = (turnNumber - 1) * turnLength;
        float  turnEndTime   = turnNumber * turnLength;
        bool   isAtEnd       = time == turnEndTime;
        Player player        = ReInput.players.GetPlayer(0);
        float  rewind        = player.GetAxis("Rewind");
        float  fastf         = player.GetAxis("Fastforward");

        time += Mathf.Pow(fastf, 4) * Time.deltaTime * 5;
        time -= Mathf.Pow(rewind, 4) * Time.deltaTime * 5;
        time  = Mathf.Clamp(time, turnBeginTime, turnEndTime);
        if (time == turnEndTime && !isAtEnd)
        {
            TimeDisplay.SetState(TimeDisplayState.END);
        }
        else if (time != turnEndTime && isAtEnd)
        {
            TimeDisplay.SetState(TimeDisplayState.NONE);
        }


        if (player.GetButton("Start") && isAtEnd)
        {
            PlayTurn();
        }
    }
예제 #3
0
 private void Start()
 {
     if (SceneManager.GetActiveScene().buildIndex == 1)
     {
         time = GameObject.FindGameObjectWithTag("Time").GetComponent <TimeDisplay>();
     }
 }
예제 #4
0
    private void InSimulate()
    {
        float tempTime;

        if (isRewindingForSimulation)
        {
            tempTime = time - Time.deltaTime * rewindSpeed;

            if (tempTime < turnStartTime)
            {
                time = turnStartTime;
                isRewindingForSimulation = false;

                TimeDisplay.SetState(TimeDisplayState.NONE);
            }
            else
            {
                time = tempTime;
            }
        }
        else
        {
            tempTime = time + Time.deltaTime * playerSpeed;
            if (tempTime > turnStartTime + turnLength)
            {
                StartNewTurn();
            }
            else
            {
                time = tempTime;
            }
        }
    }
예제 #5
0
 void PlayTurn()
 {
     ChangeState(GameState.SIMULATE_PLAY);
     //time = turnStartTime;
     TimeDisplay.SetState(TimeDisplayState.REWIND);
     isRewindingForSimulation = true;
 }
예제 #6
0
        /// <summary>
        /// Creates a new instance configured to output to the given writer.
        /// </summary>
        /// <param name="eventSource">
        /// The event source to listen to.
        /// </param>
        /// <param name="writer">The TextWriter where to send the output. Note that the writer will be disposed when the TextWriterEventListener is itself disposed.</param>
        /// <param name="baseTime">
        /// The UTC time representing time 0 for this listener.
        /// </param>
        /// <param name="warningMapper">
        /// An optional delegate that is used to map warnings into errors or to suppress warnings.
        /// </param>
        /// <param name="level">
        /// The base level of data to be sent to the listener.
        /// </param>
        /// <param name="timeDisplay">
        /// The kind of time prefix to apply to each chunk of output.
        /// </param>
        /// <param name="eventMask">
        /// If specified, an EventMask that allows selectively enabling or disabling events
        /// </param>
        /// <param name="onDisabledDueToDiskWriteFailure">
        /// If specified, called if the listener encounters a disk-write failure such as an out of space condition.
        /// Otherwise, such conditions will throw an exception.
        /// </param>
        /// <param name="pathTranslator">
        /// If specified, translates paths from one root to another
        /// </param>
        /// <param name="listenDiagnosticMessages">
        /// If true, all messages tagged with <see cref="Keywords.Diagnostics" /> at or above <paramref name="level"/> are enabled but not captured unless diagnostics are enabled per-task.
        /// This is useful for StatisticsEventListener, where you need to listen diagnostics messages but capture only ones tagged with CommonInfrastructure task.
        /// </param>
        public TextWriterEventListener(
            Events eventSource,
            IEventWriter writer,
            DateTime baseTime,
            WarningMapper warningMapper = null,
            EventLevel level            = EventLevel.Verbose,
            TimeDisplay timeDisplay     = TimeDisplay.None,
            EventMask eventMask         = null,
            DisabledDueToDiskWriteFailureEventHandler onDisabledDueToDiskWriteFailure = null,
            PathTranslator pathTranslator = null,
            bool listenDiagnosticMessages = false)
            : base(
                eventSource,
                baseTime,
                warningMapper,
                level,
                false,
                timeDisplay,
                eventMask,
                onDisabledDueToDiskWriteFailure,
                listenDiagnosticMessages)
        {
            Contract.Requires(eventSource != null);
            Contract.Requires(writer != null);

            m_writer = writer;

            m_flushTimer = new StoppableTimer(
                SynchronizedFlush,
                (int)s_flushInterval.TotalMilliseconds,
                (int)s_flushInterval.TotalMilliseconds);
            m_translator = pathTranslator;
        }
예제 #7
0
 // Start is called before the first frame update
 void Awake()
 {
     instance    = this;
     mr          = GetComponent <MeshRenderer>();
     mr.material = new Material(mr.material);
     mat         = mr.material;
 }
예제 #8
0
    IEnumerator Start()
    {
        TimeManager.OnSetTime(totalTimeInSecs, isTimed, gameMode);
        TimeDisplay.OnSetLaps(lapsToComplete);
        yield return(new WaitForEndOfFrame());

        Register();
    }
예제 #9
0
 private void Awake()
 {
     GetComponent <PlayableDirector>().stopped += EnableControl;
     timer      = GameObject.Find("Time Display").GetComponent <TimeDisplay>();
     player     = GameObject.FindWithTag("Player");
     landingPad = GameObject.FindWithTag("Friendly");
     player.GetComponent <Astronaut>().isTransitioning = true;
 }
예제 #10
0
    public void UnregisterPickup(TargetObject pickupCollected)
    {
        if (pickupCollected.gameMode != gameMode)
        {
            return;
        }

        // removes the pickup from the list, so that we can keep track of how many are left on the map
        if (pickupCollected.gameMode == GameMode.Laps)
        {
            pickupCollected.active = false;

            LapObject lapObject = (LapObject)pickupCollected;

            if (!lapObject.finishLap)
            {
                return;
            }

            if (!lapObject.lapOverNextPass)
            {
                TimeDisplay.OnUpdateLap();
                lapObject.lapOverNextPass = true;
                return;
            }

            if (NumberOfActivePickupsRemaining() != 0)
            {
                return;
            }

            ReachCheckpoint(0);
            ResetPickups();
            TimeDisplay.OnUpdateLap();
        }
        else if (pickupCollected.gameMode == GameMode.GetTime)
        {
            if (pickupCollected is LapObject)
            {
                ReachCheckpoint(0);
            }
            else
            {
                ReachCheckpoint(NumberOfPickupsRemaining - 1);
            }
        }
        else
        {
            ReachCheckpoint(NumberOfPickupsRemaining - 1);
            Pickups.Remove(pickupCollected);
            if (gameMode == GameMode.Laps)
            {
                KartGame.Track.TimeDisplay.OnUpdateLap();
            }
        }
    }
예제 #11
0
 void IsDying()
 {
     currentDeathTime += Time.deltaTime;
     time             += Time.deltaTime;
     if (currentDeathTime > deathPlayTime)
     {
         ChangeState(GameState.IS_RESURECTING);
         TimeDisplay.SetState(TimeDisplayState.REWIND);
     }
 }
예제 #12
0
    /// <summary>
    ///   Instantiates the correct kart every level.
    /// </summary>
    public void InitLevel(string sceneName)
    {
        //print("InitLevel");
        GameObject trackManagerGO = GameObject.Find("TrackManager");
        GameObject displayGO      = GameObject.Find("TimeDisplayCanvas");


        GameObject kartGO  = null;
        Vector3    kartPos = Vector3.zero;

        if (sceneName == "Level1")
        {
            kartPos = sceneData.level1KartPos;
        }
        else if (sceneName == "Level2")
        {
            kartPos = sceneData.level2KartPos;
        }

        if (isVR)
        {
            kartGO = Instantiate(VRKart, kartPos, Quaternion.identity);
        }
        else
        {
            GameObject kartParent = Instantiate(mobileKart, Vector3.zero, Quaternion.identity);
            // Get the kart gameobject
            kartGO = kartParent.transform.GetChild(1).gameObject;
            kartGO.transform.position = kartPos;
        }


        // Add kart references to classes that require it
        KartMovement          movement     = kartGO.GetComponent <KartMovement>();
        Racer                 racer        = kartGO.GetComponent <Racer>();
        KartRepositionTrigger kartRepoTrig = trackManagerGO.GetComponent <KartRepositionTrigger>();
        TimeDisplay           display      = displayGO.GetComponent <TimeDisplay>();
        AudioSource           audio        = GameObject.Find("BackgroundMusic").GetComponent <AudioSource>();

        audio.enabled = true;
        audio.Play();

        kartRepoTrig.SetMovable(movement);
        display.SetRacer(racer);


        display.enabled      = true;
        kartRepoTrig.enabled = true;

        trackManagerGO.GetComponent <TrackManager>().StartTrackManager();
        display.StartDisplay();
        // Set the Racer for EndController
        endController             = GameObject.Find("EndGameController").GetComponent <EndController>();
        endController.playerRacer = racer;
    }
예제 #13
0
    IEnumerator Start()
    {
        totalTimeInSecs = configuration.timeLap;
        isTimed         = configuration.isTimed;
        lapsToComplete  = configuration.laps;
        TimeManager.OnSetTime(totalTimeInSecs, isTimed, gameMode);
        TimeDisplay.OnSetLaps(lapsToComplete);
        yield return(new WaitForEndOfFrame());

        Register();
    }
예제 #14
0
        public void Can_Get_Time_Display_With_Hours(int hours, string noun)
        {
            // Arrange
            TimeSpan time = new TimeSpan(hours, 0, 0);

            // Act
            TimeDisplay actualTimeDisplay = TimeHelper.GetTimeDisplayFromTimeElapsed(time);

            // Assert
            Assert.Equal(hours, actualTimeDisplay.Number);
            Assert.Equal(noun, actualTimeDisplay.Text);
        }
예제 #15
0
        public void Can_Get_Time_Display_With_Minutes()
        {
            // Arrange
            TimeSpan minutes = new TimeSpan(0, 13, 0);

            // Act
            TimeDisplay actual = TimeHelper.GetTimeDisplayFromTimeElapsed(minutes);

            // Assert
            Assert.Equal(13, actual.Number);
            Assert.Equal("min", actual.Text);
        }
예제 #16
0
    void Start()
    {
        if (autoFindKarts)
        {
            //karts[0] es el creado por defecto
            karts = FindObjectsOfType <ArcadeKart>();
            if (karts.Length > 0)
            {
                if (!playerKart)
                {
                    playerKart = karts[0];
                }
            }
            DebugUtility.HandleErrorIfNullFindObject <ArcadeKart, GameFlowManager>(playerKart, this);
        }

        m_ObjectiveManager = FindObjectOfType <ObjectiveManager>();
        DebugUtility.HandleErrorIfNullFindObject <ObjectiveManager, GameFlowManager>(m_ObjectiveManager, this);

        m_TimeManager = FindObjectOfType <TimeManager>();
        DebugUtility.HandleErrorIfNullFindObject <TimeManager, GameFlowManager>(m_TimeManager, this);

        timeDisplay = FindObjectOfType <TimeDisplay>();
        DebugUtility.HandleErrorIfNullFindObject <TimeDisplay, GameFlowManager>(timeDisplay, this);

        AudioUtility.SetMasterVolume(1);

        winDisplayMessage.gameObject.SetActive(false);
        loseDisplayMessage.gameObject.SetActive(false);

        m_TimeManager.StopRace();

        foreach (ArcadeKart k in karts)
        {
            k.SetCanMove(false);
        }

        //Obtiene el anterior best time
        previousBestTime = PlayerPrefs.GetFloat("BestTime", -1);

        //Nuevo valor de best time
        bestTime = -1;

        //Obtiene la cantidad de monedas almacenadas durante el resto de partidas
        totalCoins = PlayerPrefs.GetInt("Coins", 0);

        //run race countdown animation
        ShowRaceCountdownAnimation();
        StartCoroutine(ShowObjectivesRoutine());

        StartCoroutine(CountdownThenStartRaceRoutine());
    }
예제 #17
0
    public void UnregisterPickup(TargetObject pickupCollected)
    {
        if (pickupCollected.gameMode != gameMode)
        {
            return;
        }

        // removes the pickup from the list, so that we can keep track of how many are left on the map
        if (pickupCollected.gameMode == GameMode.Laps)
        {
            pickupCollected.active = false;
            LapObject lapObject = (LapObject)pickupCollected;

            if (!lapObject.finishLap)
            {
                return;                     //Si el objeto no es la linea de meta no ejecuta las siguientes lineas
            }
            if (!lapObject.lapOverNextPass) //La primera vez que pasa por linea de meta, actualiza las vueltas e incia el tiempo
            {
                TimeDisplay.OnUpdateLap();
                if (configuration.activeObjects)
                {
                    textRank.gameObject.SetActive(true);
                }
                Item.SetActive(true);
                lapObject.lapOverNextPass = true;
                return;
            }

            if (NumberOfActivePickupsRemaining() != 0)
            {
                return;
            }
            ReachCheckpoint(0, isTimed, lapObject.TimeGained);
            ResetPickups();
            TimeDisplay.OnUpdateLap();
            if (isTimed)
            {
                TimeManager.OnAdjustTime(lapObject.TimeGained);
            }
        }
        else
        {
            ReachCheckpoint(NumberOfPickupsRemaining - 1, isTimed, 0);
            Pickups.Remove(pickupCollected);
            if (gameMode == GameMode.Laps)
            {
                KartGame.Track.TimeDisplay.OnUpdateLap();
            }
        }
    }
예제 #18
0
        /// <nodoc/>
        public static string TimeSpanToString(TimeDisplay timeDisplay, TimeSpan t)
        {
            if (timeDisplay == TimeDisplay.Seconds)
            {
                string text;
                if (t.Days > 0 || t.Hours > 0)
                {
                    text = string.Format(
                        CultureInfo.InvariantCulture,
                        "[{0}:{1:d02}:{2:d02}]",
                        (t.Days * 24) + t.Hours,
                        t.Minutes,
                        t.Seconds);
                }
                else
                {
                    text = string.Format(
                        CultureInfo.InvariantCulture,
                        "[{0}:{1:d02}]",
                        t.Minutes,
                        t.Seconds);
                }

                return(text);
            }
            else
            {
                string text;
                if (t.Days > 0 || t.Hours > 0)
                {
                    text = string.Format(
                        CultureInfo.InvariantCulture,
                        "[{0}:{1:d02}:{2:d02}.{3:d03}]",
                        (t.Days * 24) + t.Hours,
                        t.Minutes,
                        t.Seconds,
                        t.Milliseconds);
                }
                else
                {
                    text = string.Format(
                        CultureInfo.InvariantCulture,
                        "[{0}:{1:d02}.{2:d03}]",
                        t.Minutes,
                        t.Seconds,
                        t.Milliseconds);
                }

                return(text);
            }
        }
예제 #19
0
    public override void OnInitialize()
    {
        TimeDisplay tDisplay = GameObject.FindObjectOfType <TimeDisplay>();

        if (tDisplay != null)
        {
            timeDisplay = tDisplay;
            tDisplay.Initialize(this);
        }
        else
        {
            Debug.LogError("Failed to find time display object");
        }
    }
예제 #20
0
    /// <summary>
    /// Evalua el record existente
    /// </summary>
    private void EvaluateRecord()
    {
        if (currentRecord > 0)
        {
            // Show texto con el record
            recordString   = TimeDisplay.getTimeString(currentRecord);
            shownText.text = recordText + recordString;
        }

        else
        {
            // No existe ningun record aun
            shownText.text = noRecordText;
        }
    }
예제 #21
0
    void IsResurecting()
    {
        Player player = ReInput.players.GetPlayer(0);
        float  rewind = player.GetAxis("Rewind");

        if (rewind != 0)
        {
            TimeDisplay.SetState(TimeDisplayState.NONE);
        }
        time -= Mathf.Pow(rewind, 4) * Time.deltaTime * 5;
        if (time < deathStartTime - 0.2f)
        {
            ChangeState(GameState.CARD_SELECT);
        }
    }
예제 #22
0
    public void updateSpeed(Slider speedSlider)
    {
        int updateValue = (int)speedSlider.value;

        if (ht.ContainsKey(updateValue))
        {
            TimeDisplay matchedDisplay = (TimeDisplay)ht[updateValue];
            txt.text       = matchedDisplay.display;
            Time.timeScale = matchedDisplay.timeValue;
        }
        else
        {
            Debug.Log("Could not find value for updating speed. We will remain at previous value");
        }
    }
예제 #23
0
        //Remove visitor selected
        private async void VisitorOutClicked(object sender, EventArgs e)
        {
            List <EntryLog> loglistall = await App.Database.GetLogs();

            List <EntryLog> loglist = loglistall.Where(w => w.UnitName == currentunit & w.VesselName == currentvessel & w.ReferenceNFC.StartsWith(Globals.ServerName + "_V")).ToList();
            //////////////////////////////// Need to create list of visitors only

            var workerlistall = await App.Database.GetWorkers();

            workerlistall = workerlistall.Where(w => w.ReferenceNFC.StartsWith(Globals.ServerName + "_V")).ToList();

            //Viewmodel for displaying list
            List <TimeDisplay> timedisplay = new List <TimeDisplay>();
            //List<string> NFClist = new List<string>();
            CultureInfo format = new CultureInfo("en-US");

            //Pulling worker info from NFC tags and adding to UI display
            for (int i = 0; i < loglist.Count; i++)
            {
                TimeDisplay tempdisplay = new TimeDisplay();
                Worker      tempworker  = workerlistall.Where(w => w.ReferenceNFC == loglist[i].ReferenceNFC).FirstOrDefault();

                tempdisplay.DateLog   = loglist[i].TimeLog.ToString("dddd-dd", format);
                tempdisplay.TimeLog   = loglist[i].TimeLog.ToString("MM/dd h:mm tt", format);
                tempdisplay.FirstName = tempworker.FirstName.FirstOrDefault() + ".";
                tempdisplay.LastName  = tempworker.LastName;
                tempdisplay.Company   = tempworker.Company;
                tempdisplay.EntryID   = loglist[i].EntryID;
                timedisplay.Add(tempdisplay);
                //NFClist.Add(tempworker.ReferenceNFC);
            }

            if (timedisplay.Count == 0)
            {
                await DisplayAlert("Visitor Sign-out Error", "No Visitors at Location", "Return to Portal");
            }
            else
            {
                var inputPopup = new VisitorOutPopup(timedisplay);
                await PopupNavigation.Instance.PushAsync(inputPopup, true);

                var ret = await inputPopup.PopupClosedTask;
                SetCSEList();
            }
        }
예제 #24
0
        async void WorkerExitSelected(object sender, EventArgs e)
        {
            var         LineSelectedvar = workersview.SelectedItem;
            TimeDisplay LineSelected    = (TimeDisplay)LineSelectedvar;

            if (LineSelected != null) //Don't display options if deselecting was trigger
            {
                string answer = await DisplayActionSheet("User Selection Options", "Cancel", null, "Manual Sign-Out");

                if (answer == "Manual Sign-Out") //Sign out Logged User
                {
                    await CreateLog(LineSelected.ReferenceNFC, -1, LineSelected.EntryID);

                    SetCSEList();
                }
                workersview.SelectedItem = null;
            }
        }
예제 #25
0
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="eventSource">
        /// The event source to listen to.
        /// </param>
        /// <param name="baseTime">
        /// The UTC time representing time 0 for this listener.
        /// </param>
        /// <param name="warningMapper">
        /// An optional delegate that is used to map warnings into errors or to suppress warnings.
        /// </param>
        /// <param name="level">
        /// The base level of data to be sent to the listener.
        /// </param>
        /// <param name="captureAllDiagnosticMessages">
        /// If true, all messages tagged with <see cref="Keywords.Diagnostics" /> are captured.
        /// </param>
        /// <param name="timeDisplay">
        /// The kind of time prefix to apply to each chunk of output.
        /// </param>
        /// <param name="eventMask">
        /// If specified, an EventMask that allows selectively enabling or disabling events
        /// </param>
        /// <param name="onDisabledDueToDiskWriteFailure">
        /// If specified, called if the listener encounters a disk-write failure such as an out of space condition.
        /// Otherwise, such conditions will throw an exception.
        /// </param>
        /// <param name="listenDiagnosticMessages">
        /// If true, all messages tagged with <see cref="Keywords.Diagnostics" /> at or above <paramref name="level"/> are enabled but not captured unless diagnostics are enabled per-task.
        /// This is useful for StatisticsEventListener, where you need to listen diagnostics messages but capture only ones tagged with CommonInfrastructure task.
        /// </param>
        /// <param name="useCustomPipDescription">
        /// If true, pip description string will be changed to (SemiStableHash, CustomerSuppliedPipDescription).
        /// If true but no custom description available, no changes will be made.
        /// </param>
        protected FormattingEventListener(
            Events eventSource,
            DateTime baseTime,
            WarningMapper warningMapper       = null,
            EventLevel level                  = EventLevel.Verbose,
            bool captureAllDiagnosticMessages = false,
            TimeDisplay timeDisplay           = TimeDisplay.None,
            EventMask eventMask               = null,
            DisabledDueToDiskWriteFailureEventHandler onDisabledDueToDiskWriteFailure = null,
            bool listenDiagnosticMessages = false,
            bool useCustomPipDescription  = false)
            : base(eventSource, warningMapper, level, captureAllDiagnosticMessages, eventMask, onDisabledDueToDiskWriteFailure, listenDiagnosticMessages)
        {
            Contract.Requires(eventSource != null);

            BaseTime                = baseTime;
            TimeDisplay             = timeDisplay;
            UseCustomPipDescription = useCustomPipDescription;
        }
예제 #26
0
 private void Update()
 {
     TimeDisplay.SetTime();
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (paused)
         {
             Unpause();
         }
         else
         {
             Pause();
         }
     }
     if (!paused)
     {
         if (Input.GetKeyDown(KeyCode.E) && DialogueManager.playingConversation)
         {
             _UIScript.HidePlayerUI();
             DialogueManager.instance.DisplayNextSentence();
         }
         if (TimeDisplay.hours == 0 && TimeDisplay.minutes == 1 && TimeSinceLastRobbers > 5)
         {
             TimeSinceLastRobbers = 0;
             StartCoroutine(SpawnGraveRobbers(RobbersPerSpawn));
         }
     }
     timeSinceLastDialogueStarted += Time.deltaTime;
     TimeSinceLastRobbers         += Time.deltaTime;
     if (!_isPlayingTutorial)
     {
         timeSinceLastPrompt     += Time.deltaTime;
         timeSinceLastMiscPrompt += Time.deltaTime;
         if (timeSinceLastPrompt > timeBetweenPrompts)
         {
             timeSinceLastPrompt = 0f;
             StartCoroutine(ShowPrompt());
         }
     }
 }
예제 #27
0
        private string[] CalculateXValues(DateTime dateTime1, DateTime dateTime2)
        {
            float timeInterval = (float)(dateTime2 - dateTime1).TotalDays / Graph.NUM_HELPER_LINES;

            string[] values  = new string[Graph.NUM_HELPER_LINES];
            DateTime curDate = dateTime1;

            if (timeInterval >= 365)
            {
                timeDisplay = TimeDisplay.year;
            }
            else if (timeInterval >= 30.5)
            {
                timeDisplay = TimeDisplay.month;
            }
            else
            {
                timeDisplay = TimeDisplay.day;
            }

            for (int i = 0; i < Graph.NUM_HELPER_LINES; ++i)
            {
                if (timeDisplay == TimeDisplay.day)
                {
                    values[i] = curDate.Day + "/" + curDate.Month;
                }
                else if (timeDisplay == TimeDisplay.month)
                {
                    values[i] = curDate.ToString("MMMM");
                }
                else
                {
                    values[i] = curDate.Year.ToString();
                }
                curDate = curDate.AddDays(timeInterval);
            }

            return(values);
        }
예제 #28
0
        private static void activateIntrfaceVersion()
        {
            Interfaces.MenuItem  m_VersionsAndActions = new Interfaces.MenuItem("Versions and Actions", null);
            Interfaces.IDoAction showVersion          = new VersionDisplay();
            Interfaces.MenuItem  m_ShowVersion        = new Interfaces.MenuItem("Show Version", showVersion);

            m_VersionsAndActions.AddMenuItem(m_ShowVersion);

            Interfaces.MenuItem  m_Actions     = new Interfaces.MenuItem("Actions", null);
            Interfaces.IDoAction charsCount    = new CharsCount();
            Interfaces.MenuItem  m_CharsCount  = new Interfaces.MenuItem("Chars Count", charsCount);
            Interfaces.IDoAction countSpaces   = new SpacesCount();
            Interfaces.MenuItem  m_CountSpaces = new Interfaces.MenuItem("Count Spaces", countSpaces);

            m_Actions.AddMenuItem(m_CharsCount);
            m_Actions.AddMenuItem(m_CountSpaces);
            m_VersionsAndActions.AddMenuItem(m_Actions);

            // Show Time and Date menu
            Interfaces.MenuItem  m_ShowDateAndTime = new Interfaces.MenuItem("Show Date/Time", null);
            Interfaces.IDoAction showTime          = new TimeDisplay();
            Interfaces.MenuItem  m_ShowTime        = new Interfaces.MenuItem("Show Time", showTime);
            Interfaces.IDoAction showDate          = new DateDisplay();
            Interfaces.MenuItem  m_ShowDate        = new Interfaces.MenuItem("Show Date", showDate);

            m_ShowDateAndTime.AddMenuItem(m_ShowTime);
            m_ShowDateAndTime.AddMenuItem(m_ShowDate);

            // Main menu
            Interfaces.MenuItem firstMenu = new Interfaces.MenuItem("My Menu implemented with Interfaces", null);
            Interfaces.MainMenu mainMenu  = new Interfaces.MainMenu(firstMenu);

            firstMenu.AddMenuItem(m_VersionsAndActions);
            firstMenu.AddMenuItem(m_ShowDateAndTime);

            mainMenu.Show();
        }
예제 #29
0
 /// <summary>
 /// <see cref="TextWriterEventListener(Events, IEventWriter, DateTime, BuildXL.Utilities.Tracing.BaseEventListener.WarningMapper, EventLevel, TimeDisplay, EventMask, BaseEventListener.DisabledDueToDiskWriteFailureEventHandler, PathTranslator, bool)"/>.
 /// </summary>
 public TextWriterEventListener(
     Events eventSource,
     TextWriter writer,
     DateTime baseTime,
     WarningMapper warningMapper = null,
     EventLevel level            = EventLevel.Verbose,
     TimeDisplay timeDisplay     = TimeDisplay.None,
     EventMask eventMask         = null,
     DisabledDueToDiskWriteFailureEventHandler onDisabledDueToDiskWriteFailure = null,
     PathTranslator pathTranslator = null,
     bool listenDiagnosticMessages = false)
     : this(
         eventSource,
         new TextEventWriter(writer),
         baseTime,
         warningMapper,
         level,
         timeDisplay,
         eventMask,
         onDisabledDueToDiskWriteFailure,
         pathTranslator,
         listenDiagnosticMessages)
 {
 }
예제 #30
0
 public ConsoleEventListener(Events eventSource, DateTime baseTime, WarningMapper warningMapper = null, EventLevel level = EventLevel.Verbose, bool captureAllDiagnosticMessages = false, TimeDisplay timeDisplay = TimeDisplay.None, EventMask eventMask = null, DisabledDueToDiskWriteFailureEventHandler onDisabledDueToDiskWriteFailure = null, bool listenDiagnosticMessages = false, bool useCustomPipDescription = false)
     : base(eventSource, baseTime, warningMapper, level, captureAllDiagnosticMessages, timeDisplay, eventMask, onDisabledDueToDiskWriteFailure, listenDiagnosticMessages, useCustomPipDescription)
 {
 }