Esempio n. 1
0
        // TO DO: Move out of FrostbiteClient.
        public static void RaiseEvent(Delegate[] a_delInvokes, params object[] a_objArguments)
        {
            for (int i = 0; i < a_delInvokes.Length; i++)
            {
                try {
                    if (a_delInvokes[i].Target is Form)
                    {
                        if (((Form)a_delInvokes[i].Target).Disposing == false && ((Form)a_delInvokes[i].Target).IsDisposed == false && ((Form)a_delInvokes[i].Target).IsHandleCreated == true)
                        {
                            try {
                                ((Control)a_delInvokes[i].Target).Invoke(a_delInvokes[i], a_objArguments);
                            }
                            catch (InvalidOperationException) { }
                        }
                    }
                    else if (a_delInvokes[i].Target is Control)
                    {
                        if (((Control)a_delInvokes[i].Target).Disposing == false && ((Control)a_delInvokes[i].Target).IsDisposed == false)  //
                        {
                            try {
                                ((Control)a_delInvokes[i].Target).Invoke(a_delInvokes[i], a_objArguments);
                            }
                            catch (InvalidOperationException) { }
                        }
                    }
                    else
                    {
                        //a_delInvokes[i].Method.Invoke(a_delInvokes[i].Target, a_objArguments);
                        a_delInvokes[i].DynamicInvoke(a_objArguments);
                    }
                }
                catch (Exception e) {
                    string strParams = String.Empty;

                    if (a_objArguments != null)
                    {
                        foreach (object objParam in a_objArguments)
                        {
                            strParams += ("---" + objParam.ToString());
                        }
                    }

                    FrostbiteConnection.LogError(String.Format("{0} ::: {1} ::: {2}", a_delInvokes[i].Target.ToString(), a_delInvokes[i].Method.ToString(), strParams), String.Empty, e);
                }
            }
        }
Esempio n. 2
0
        // TO DO: Move out of FrostbiteClient.
        public static void RaiseEvent(Delegate[] invokes, params object[] arguments)
        {
            for (int i = 0; i < invokes.Length; i++)
            {
                try {
                    if (invokes[i].Target is Form)
                    {
                        if (((Form)invokes[i].Target).Disposing == false && ((Form)invokes[i].Target).IsDisposed == false && ((Form)invokes[i].Target).IsHandleCreated == true)
                        {
                            try {
                                ((Control)invokes[i].Target).Invoke(invokes[i], arguments);
                            }
                            catch (InvalidOperationException) { }
                        }
                    }
                    else if (invokes[i].Target is Control)
                    {
                        if (((Control)invokes[i].Target).Disposing == false && ((Control)invokes[i].Target).IsDisposed == false)  //
                        {
                            try {
                                ((Control)invokes[i].Target).Invoke(invokes[i], arguments);
                            }
                            catch (InvalidOperationException) { }
                        }
                    }
                    else
                    {
                        invokes[i].DynamicInvoke(arguments);
                    }
                }
                catch (Exception e) {
                    string strParams = String.Empty;

                    if (arguments != null)
                    {
                        strParams = arguments.Aggregate(strParams, (current, objParam) => current + ("---" + objParam.ToString()));
                    }

                    FrostbiteConnection.LogError(String.Format("{0} ::: {1} ::: {2}", invokes[i].Target, invokes[i].Method, strParams), String.Empty, e);
                }
            }
        }