Exemplo n.º 1
0
        /// <summary>
        /// Checks for updates on a mod.
        /// </summary>
        private async Task <bool> CheckForUpdates(Mod m)
        {
            if (m.IsLocal)
            {
                return(true);
            }
            m.Busy = true;
            string modString = string.Empty;

            using (WebClient wc = new WebClient()) {
                try {
                    modString = await wc.DownloadStringTaskAsync(apiGetURL + m.Id);
                } catch (WebException ex) {
                    dynamic Data = new OnErrorArgs
                    {
                        Message = m.Name + "error:" + ex.Message
                    };
                    OnError?.Invoke(this, Data);
                    m.Busy = false;
                    return(true);
                }
                JsonObject json    = JsonObject.Parse(modString);
                var        updated = DateTime.ParseExact(json["modified"].Replace("T", " "), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
                if (updated > m.Date)
                {
                    m.UpdateAvailable = true;
                    UpdateSettings();
                }
            }
            m.Busy = false;
            return(true);
        }
Exemplo n.º 2
0
 public virtual void FireError(OnErrorArgs args)
 {
     if (this.OnError != null)
     {
         this.OnError.Invoke(this, args);
     }
 }
Exemplo n.º 3
0
 private void Error(OnErrorArgs args)
 {
     if (this.OnError != null)
     {
         this.OnError.Invoke(this, args);
     }
     this.XSocketClient.FireError(args);
 }
 void wss_OnError(object sender, OnErrorArgs e)
 {
     Debug.WriteLine("");
     Debug.WriteLine("Error");
     Debug.WriteLine("ExceptionMessage: " + e.Exception.Message);
     Debug.WriteLine("CustomMessage: " + e.Message);
     Debug.WriteLine("");
 }
 void wss_OnError(object sender, OnErrorArgs e)
 {
     Debug.WriteLine("");
     Debug.WriteLine("Error");
     Debug.WriteLine("ExceptionMessage: " + e.Exception.Message);
     Debug.WriteLine("CustomMessage: " + e.Message);
     Debug.WriteLine("");
 }
Exemplo n.º 6
0
        protected void OnErrorEventHandler(OnErrorArgs e)
        {
            var handler = ErrorEventHandler;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 7
0
        public virtual async Task FireOnMessage(IMessage message)
        {
            try
            {
                if (message.Topic == Globals.Constants.Events.AuthenticationFailed)
                {
                    if (this.OnAuthenticationFailed != null)
                    {
                        this.OnAuthenticationFailed.Invoke(this, null);
                    }
                    this.AutoReconnect = false;
                    await this.Disconnect();

                    return;
                }

                if (message.Topic == Constants.Events.Error && message.Controller == string.Empty)
                {
                    if (this.OnError != null)
                    {
                        OnErrorArgs errArgs = null;
                        try
                        {
                            errArgs = new OnErrorArgs(this.Serializer.DeserializeFromString <Exception>(message.Data));
                        }
                        catch
                        {
                            errArgs = new OnErrorArgs(message.Data);
                        }

                        this.OnError.Invoke(this, errArgs);
                    }
                    return;
                }

                var controller = this.Controllers.GetById(message.Controller);
                if (!await this.HandleQoS(message, controller))
                {
                    return;
                }
                controller.FireOnMessage(message);
            }
            catch (Exception ex) // Will dispatch to OnError on exception
            {
                if (this.OnError != null)
                {
                    this.OnError.Invoke(this, new OnErrorArgs(ex));
                }
            }
        }
Exemplo n.º 8
0
 void wss_OnError(object sender, OnErrorArgs e)
 {
     try
     {
         Debug.WriteLine("");
         Debug.WriteLine("Error");
         Debug.WriteLine("ExceptionMessage: " + e.Exception.Message);
         Debug.WriteLine("CustomMessage: " + e.Message);
         Debug.WriteLine("");
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         Debug.WriteLine(ex.StackTrace);
     }
 }
Exemplo n.º 9
0
        private void Error(IMessage error)
        {
            var err = new OnErrorArgs(this.XSocketClient.Serializer.DeserializeFromString <Exception>(error.Data));

            this.Error(err);
        }
Exemplo n.º 10
0
 private void CameraTriggerError(object sender, OnErrorArgs args)
 {
     _eventAggregator.GetEvent <ExceptionEvent>().Publish(new CameraRuntimeException(args.Message));
 }
Exemplo n.º 11
0
 private void FinderSystem_OnError(object sender, OnErrorArgs args)
 {
     this.Invoke(new Action(() => LogError(args.Exception.Message)));
 }
Exemplo n.º 12
0
 void DataManager_ErrorEventHandler(object sender, OnErrorArgs e)
 {
     MsgHelpers.ShowError(this, e.CException.Message);
 }
Exemplo n.º 13
0
 protected void Facade_ErrorEventHandler(object sender, OnErrorArgs e)
 {
     //LoggerService.Instance.Error("Error on " + sender.GetType(), e.CException);
     Message   = ExceptionHelpers.GetMessage(e.CException);
     IsSuccess = false;
 }
Exemplo n.º 14
0
 private void OnClientError(object sender, OnErrorArgs args)
 {
     log.Error(args.Message, args.Exception);
 }