private IEnumerator _updateCoroutine()
    {
        UpdateStart.Invoke();
        yield return(StartCoroutine(_downloadAndInitializeEventsCoroutine()));

        UpdateEnd.Invoke();
    }
예제 #2
0
        public static void Start()
        {
            network.Start(config.MulticastInterface);
            redistribution.UpdateStart      += () => UpdateStart?.Invoke();
            redistribution.UpdateComplete   += () => UpdateComplete?.Invoke();
            redistribution.StateChangeEvent += (s) => StateChangeEvent?.Invoke(s);

            redistribution.HandleLogEvent   += _client_HandleLogEvent;
            redistribution.HandleErrorEvent += _client_HandleErrorEvent;

            _client = new Client(network, config, redistribution);
            _client.StateChangeEvent += (s) => StateChangeEvent?.Invoke(s);
        }
예제 #3
0
        private void UpdateRoles()
        {
            try
            {
                taskinprogress = true;
                UpdateStart?.Invoke();
                do
                {
                    Tuple <CommandId, RoleSet, IPAddress> request;
                    lock (_requeststatemutex)
                    {
                        request = requeststate;
                    }

                    UpdateStart?.Invoke();
                    StateChangeEvent?.Invoke("Perform update operation");
                    Stop();
                    BuildFromConfig(request.Item2);
                    if (request.Item1 == CommandId.DryRun) //do total repositori cleanup
                    {
                        try
                        {
                            DirectoryUtils.TryDeleteDirectory(_repositorystoragepath);
                        }
                        catch (Exception e)
                        {
                            OnErrorEvent(e.Message);
                        }
                        Directory.CreateDirectory(_repositorystoragepath);
                    }

                    RunCommandOnNodes(request.Item1, request.Item3);
                    UpdateComplete?.Invoke();
                    StateChangeEvent?.Invoke("update operation finished");
                    lock (_requeststatemutex)
                    {
                        var checkrequest = requeststate;
                        if (checkrequest.Item1 == requeststate.Item1 && checkrequest.Item2 == requeststate.Item2 &&
                            Equals(checkrequest.Item3, requeststate.Item3))
                        {
                            taskinprogress = false; //finish operation
                        }
                    }
                } while (taskinprogress);
            }
            catch (Exception e)
            {
                taskinprogress = false;
            }
        }
예제 #4
0
 protected void OnUpdateStart(UpdateStartEventArgs <TGrid, TPos> updateStartEventArgs)
 {
     UpdateStart?.Invoke(this, updateStartEventArgs);
 }
 public static void OnUpdateStart(object sender, UpdateEventArgs ev) => UpdateStart?.Invoke(sender, ev);