private void NewScenario(ScenarioBase newScenario)
 {
     newScenario.InitializeAsync((res) => {
         if (res)
         {
             newScenario.AfterInitilize();
         }
     });
     newScenario.Name = "Новый сценарий";
     _repository.AddScenario(newScenario);
     switchesGrid.Add(newScenario);
     constructorsResolver.SetScenario(newScenario);
 }
示例#2
0
 public void Revert()
 {
     try
     {
         _clonedScenario = (ScenarioBase)Lazurite.Windows.Utils.Utils.CloneObject(_originalSenario);
         _clonedScenario.InitializeAsync();
         buttonsView.Revert(_clonedScenario);
         _constructorView.Revert(_clonedScenario);
         IsModified = false;
     }
     catch (Exception e)
     {
         Log.ErrorFormat(e, "Ошибка инициализации сценария {0}", _clonedScenario.Name);
     }
 }
示例#3
0
 public void SetScenario(ScenarioBase scenario, Action callback = null)
 {
     StuckUILoadingWindow.Show(
         "Компоновка окна...",
         () =>
     {
         if (scenario != null)
         {
             try
             {
                 _originalSenario = scenario;
                 _clonedScenario  = (ScenarioBase)Lazurite.Windows.Utils.Utils.CloneObject(_originalSenario);
                 _clonedScenario.InitializeAsync();
                 if (scenario is SingleActionScenario)
                 {
                     contentPresenter.Content = _constructorView = new SingleActionScenarioView((SingleActionScenario)_clonedScenario);
                 }
                 else if (scenario is RemoteScenario)
                 {
                     contentPresenter.Content = _constructorView = new RemoteScenarioView((RemoteScenario)_clonedScenario);
                 }
                 else if (scenario is CompositeScenario)
                 {
                     contentPresenter.Content = _constructorView = new CompositeScenarioView((CompositeScenario)_clonedScenario);
                 }
                 buttonsView.SetScenario(_clonedScenario);
                 IsModified = false;
                 _constructorView.Modified += () => Modified?.Invoke();
                 _constructorView.Modified += () => buttonsView.ScenarioModified();
                 _constructorView.Modified += () => IsModified = true;
                 _constructorView.Failed   += () => buttonsView.Failed();
                 _constructorView.Succeed  += () => buttonsView.Success();
                 EmptyScenarioModeOff();
             }
             catch (Exception e)
             {
                 Log.ErrorFormat(e, "Ошибка инициализации сценария {0}", scenario.Name);
             }
         }
         else
         {
             EmptyScenarioModeOn();
         }
         callback?.Invoke();
     }
         );
 }
        static async Task MainAsync(string[] args)
        {
            string scenarioToRun = Program.DefaultQuickstartScenario;

            if (args.Length == 1)
            {
                scenarioToRun = args[0];
            }

            // Read the input parameters, either from command line or environment variables
            //string hostname = CassandraQuickstart.GetEnvironmentVariable("hostname", "<FILL_IN_FROM_AZURE_PORTAL>");
            //string userName = CassandraQuickstart.GetEnvironmentVariable("userName", "<FILL_IN_FROM_AZURE_PORTAL>");
            //string password = CassandraQuickstart.GetEnvironmentVariable("password", "<FILL_IN_FROM_AZURE_PORTAL>");
            string hostname = Program.GetEnvironmentVariable("hostname", "sivethetest-cassandra.cassandra.cosmosdb.azure.com");
            string userName = Program.GetEnvironmentVariable("user", "sivethetest-cassandra");
            string password = Program.GetEnvironmentVariable("password", "Nap6LRrHFAPydUqv6TWDXUXaaHXaw7fb68lsc6TNDq9xC0QlYQsDhiIiA6q0PzvXZ9JJ89FhlrVXqwTA0mcckQ==");

            Console.WriteLine($"Executing scenario: {scenarioToRun}\n");
            ScenarioBase scenario = Program.ConstructScenario(scenarioToRun);
            await scenario.InitializeAsync(hostname, userName, password);

            await scenario.RunScenarioAsync();
        }
示例#5
0
 private void ApplyInternal(bool reset = true)
 {
     try
     {
         Repository.SaveScenario(_clonedScenario);
         StatisticsManager.ReRegister(_clonedScenario);
         _clonedScenario.InitializeAsync();
         _clonedScenario.AfterInitilize();
         IsModified = false;
         if (reset)
         {
             SetScenario(_clonedScenario, Applied);
         }
         else
         {
             _originalSenario = _clonedScenario; //crutch
             Applied?.Invoke();
         }
     }
     catch (Exception e)
     {
         Log.ErrorFormat(e, "Ошибка инициализации сценария {0}", _clonedScenario.Name);
     }
 }