示例#1
0
 /// <summary> Gets value of given name which is accessible from selected function </summary>
 /// <returns> Null if not found </returns>
 public NamedValue GetValue(string name)
 {
     if (SelectedFunction == null || IsRunning)
     {
         return(null);
     }
     else
     {
         return(SelectedFunction.GetValue(name));
     }
 }
示例#2
0
    private void Awake()
    {
        System.Random random = new System.Random();

        switch (random.Next(0, 3))
        {
        case 0:
            print("Current Scenario: Low Suction");
            cavitationUtility.inletTarget  = 1;
            cavitationUtility.outletTarget = 2;
            cavitationUtility.inletSlider.GetComponent <Slider>().value  = 0.1f;
            cavitationUtility.outletSlider.GetComponent <Slider>().value = 0.7f;
            selectedFunction = LowSuction;
            selectedAudio    = "Low Suction Story";
            break;

        case 1:
            print("Current Scenario: High Discharge");
            cavitationUtility.inletTarget  = 1;
            cavitationUtility.outletTarget = 0;
            cavitationUtility.inletSlider.GetComponent <Slider>().value  = 0.4f;
            cavitationUtility.outletSlider.GetComponent <Slider>().value = 0.9f;
            selectedFunction = HighDischarge;
            selectedAudio    = "High Discharge Story";
            break;

        case 2:
            print("Current Scenario: Recirculation");
            cavitationUtility.inletTarget  = 1;
            cavitationUtility.outletTarget = 2;
            cavitationUtility.inletSlider.GetComponent <Slider>().value  = 0.5f;
            cavitationUtility.outletSlider.GetComponent <Slider>().value = 0.3f;
            selectedFunction = Recirculation;
            selectedAudio    = "Recirculation Story";
            break;

        default:
            Debug.LogError("A random number outside the range of 0 - 2 was created");
            break;
        }
    }
        public override async void ExecuteFunction()
        {
            var taskList  = new List <Task>();
            var message   = JObject.Parse(SampleMessageInput);
            var startTime = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff");

            message["FromPublisher"] = startTime;
            for (var i = 0; i < PublicationsCount; i++)
            {
                taskList.Add(SelectedFunction.ExecuteFunction(message));
            }

            await Task.WhenAll(taskList);

            var endTime = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff");
            var start   = Convert.ToDateTime(startTime);
            var end     = Convert.ToDateTime(endTime);
            var total   = (end - start).TotalMilliseconds;

            Publisher.AppendText($"Total Time Taken: {total}");
        }
示例#4
0
        private void FunctionButton_Click(object sender, RoutedEventArgs e)
        {
            if (double.TryParse(resultLabel.Content.ToString(), out lastNumber))
            {
                resultLabel.Content = "0";
            }

            if (sender == multButton)
            {
                SelectedFunction = SelectedFunction.Multiplication;
            }
            if (sender == divButton)
            {
                SelectedFunction = SelectedFunction.Division;
            }
            if (sender == addButton)
            {
                SelectedFunction = SelectedFunction.Addition;
            }
            if (sender == subButton)
            {
                SelectedFunction = SelectedFunction.Subtraction;
            }
        }
 public void StepOut()
 {
     SelectedFunction.StepOut();
 }
 public void StepOver()
 {
     SelectedFunction.StepOver();
 }
 public void StepInto()
 {
     SelectedFunction.StepInto();
 }