private void ComplexEdit(object sender, TextChangedEventArgs e)
        {
            if (!_cantrigger)
            {
                return;
            }
            try
            {
                var tb = sender as TextBox;
                switch (tb.Name)
                {
                case "TbRealValue":
                case "TbImaginaryValue":
                    var cmp = Complex;
                    _cantrigger  = false;
                    TbAbs.Text   = cmp.Magnitude.ToString();
                    TbAngle.Text = TrigFunctions.ArcTan(cmp.Imaginary / cmp.Real).ToString();
                    _cantrigger  = true;
                    break;

                case "TbAbs":
                case "TbAngle":
                    var cmplx = TypeFunctions.CplxPolar(Convert.ToDouble(TbAbs.Text), Convert.ToDouble(TbAngle.Text));
                    _cantrigger           = false;
                    TbRealValue.Text      = cmplx.Real.ToString();
                    TbImaginaryValue.Text = cmplx.Imaginary.ToString();
                    _cantrigger           = true;
                    break;
                }
            }
            catch (Exception) { _cantrigger = true; }
        }
Example #2
0
        public static Byte[] LoadImage(Image pImage, string pExtension)
        {
            Byte[] imgByte = null;
            switch (pExtension)
            {
            case "":
            case null:
            case ".jpeg":
            case ".jpg":
            {
                imgByte = TypeFunctions.ConvertImageToByteArray(pImage, ImageFormat.Jpeg);

                break;
            }

            case ".gif":
            {
                imgByte = TypeFunctions.ConvertImageToByteArray(pImage, ImageFormat.Gif);

                break;
            }
            }


            return(imgByte);
        }
Example #3
0
            static int ProcessAlpha(Char[] inputMASCK, StringBuilder resultMASCK, int index, char sourceChar, char destChar)
            {
                int endPosition = 0;


                if (inputMASCK[index].CompareTo(sourceChar) == 0)
                {
                    if (index == inputMASCK.Length - 1)
                    {
                        resultMASCK.Append(destChar);
                        return(index);
                    }
                    //Solo inserto la a si el caracter proximo es tambien a
                    if (inputMASCK[index + 1].CompareTo(sourceChar) == 0)
                    {
                        resultMASCK.Append(destChar);
                    }
                    //Si el caracter proximo es numerico
                    if (TypeFunctions.IsInteger(inputMASCK[index + 1].ToString()))
                    {
                        IsnsertChar(inputMASCK, index, resultMASCK, destChar, out endPosition);
                        index = endPosition;
                    }
                    //Si llego hasta aqui es que es algun caracter cualquiera que no reporecenta logica
                    resultMASCK.Append(destChar);
                }
                return(index);
            }
Example #4
0
            /// <summary>
            /// Retorna el entero
            /// </summary>
            /// <param name="array"></param>
            /// <param name="start">posicion desde donde se comienza a</param>
            /// <param name="number"></param>
            /// <param name="endPosition"></param>
            static void GetNumber(Char[] array, int startPosition, out int numberValue, out int endPosition)
            {
                //Lista q contiene la concatenacion de enteros detectados en el ciclo for.
                StringBuilder numberAux = new StringBuilder();

                //La posicion final es = inicio de conteo hasta la cantidad de numeros
                endPosition = startPosition - 1;


                for (int i = startPosition; i < array.Length; i++)
                {
                    //si es un numero lo agrego a la lista de numero
                    if (TypeFunctions.IsInteger(array[i].ToString()))
                    {
                        numberAux.Append(array[i].ToString());
                        endPosition++;
                    }
                    else
                    {
                        break;
                    }
                }

                numberValue = Convert.ToInt32(numberAux.ToString());
            }
Example #5
0
        public void RegisteredBooleanTypeProcedureDoesExist()
        {
            var engine   = new Engine();
            var captured = default(Object);

            TypeProcedures.Register <Boolean>(_ => (args, value) => { captured = value; });
            engine.Interpret("true(3) = 5");
            TypeFunctions.Unregister <Boolean>();
            Assert.AreEqual(5.0, captured);
        }
Example #6
0
        public void RegisteredBooleanTypeFunctionDoesExist()
        {
            var engine = new Engine();

            TypeFunctions.Register <Boolean>(_ => args => args[0]);
            var result = engine.Interpret("true(3)");

            TypeFunctions.Unregister <Boolean>();
            Assert.AreEqual(3.0, result);
        }
Example #7
0
        protected override void SaveModifications()
        {
            bool exist = false;

            if (ActionType == Fwk.UI.Common.ActionTypes.Create)
            {
                if (_ParentGroup != null) // se debe validar ya que si no tiene otros nodos el parent es null
                {
                    if (_ParentGroup.ContainTree)
                    {
                        exist = _ParentGroup.MenuBarTree.Exist(txtId.Text);
                    }
                    else
                    {
                        exist = _ParentGroup.Buttons.Exist(txtId.Text);
                    }
                }


                if (exist)
                {
                    if (SimpleMessageView.Show(string.Concat("Ya existe un ID = ", txtId.Text, ". ¿Desea sobre escribir este item de menú?"),
                                               "Menu", MessageBoxButtons.YesNo, Fwk.UI.Common.MessageBoxIcon.Question) == DialogResult.No)
                    {
                        txtId.SelectAll();
                        txtId.Focus();
                        return;
                    }


                    List <Fwk.UI.Controls.Menu.ButtonBase> a = (from item in _ParentGroup.Buttons
                                                                where item.Id.Equals(txtId.Text.Trim(), StringComparison.OrdinalIgnoreCase)
                                                                select item).ToList <Fwk.UI.Controls.Menu.ButtonBase>();

                    _CopyButton = a[0];
                }
            }
            _CopyButton.Id           = txtId.Text;
            _CopyButton.AssemblyInfo = txtAssemblyInfo.Text;
            _CopyButton.Caption      = txtCaption.Text;
            _CopyButton.Shortcut     = txtShortCut.Text;
            _CopyButton.ToolTipText  = txtToolTip.Text;


            if (pctSmallImage.Image != null)
            {
                _CopyButton.Image = TypeFunctions.ConvertImageToByteArray(pctSmallImage.Image, ImageFormat.Png);
            }
            if (pctLargeImage.Image != null)
            {
                _CopyButton.LargeImage = TypeFunctions.ConvertImageToByteArray(pctLargeImage.Image, ImageFormat.Png);
            }

            OnMenuItemSaved(new MenuItemSavedEventArgs(_CopyButton));
        }
Example #8
0
    private void Start()
    {
        var meshes = GetComponentsInChildren <TextMesh>();

        _typeText      = meshes[0];
        _typeText.text = TypeFunctions.NameOf(_type);
        name           = _typeText.text;

        _pointsText      = meshes[1];
        _pointsText.text = "" + _value;

        _dropZone = GetComponent <BoxCollider2D>();
        UnSelect();
    }
Example #9
0
        protected override void SaveModifications()
        {
            //_OriginalButton.BeginGroup = _Button.BeginGroup;
            _OriginalButton.Caption = _Button.Caption;
            _OriginalButton.Hint    = _Button.Hint;
            _OriginalButton.Id      = _Button.Id;
            if (pctImage.Image != null)
            {
                _OriginalButton.Image = TypeFunctions.ConvertImageToByteArray(pctImage.Image, ImageFormat.Png);
            }
            _OriginalButton.Shortcut    = _Button.Shortcut;
            _OriginalButton.ToolTipText = _Button.ToolTipText;

            OnMenuItemSaved(new MenuItemSavedEventArgs(_OriginalButton));
        }
        /// <summary>
        /// Rellena los valores del menu
        /// </summary>
        public void Populate()
        {
            this.txtDisplayName.Text     = _MenuItemSelected.DisplayName;
            this.txtAssembly.Text        = _MenuItemSelected.AssemblyInfo;
            this.txtFormName.Text        = _MenuItemSelected.FormName;
            this.txtToolTipInfo.Text     = _MenuItemSelected.ToolTipInfo;
            this.checkBoxEnabled.Checked = _MenuItemSelected.Enabled;



            if (_MenuItemSelected.NodeSelectedImage != null)
            {
                this.pictureBoxImageSelected.Image = TypeFunctions.ConvertByteArrayToImage(_MenuItemSelected.NodeSelectedImage);
            }
            else
            {
                pictureBoxImageSelected.Image = null;
            }

            if (_MenuItemSelected.NodeImage != null)
            {
                this.pictureBoxImage.Image = TypeFunctions.ConvertByteArrayToImage(_MenuItemSelected.NodeImage);
            }
            else
            {
                pictureBoxImage.Image = null;
            }



            if (_MenuItemSelected.TypeImage != null)
            {
                this.pictureBoxTypeImage.Image = TypeFunctions.ConvertByteArrayToImage(_MenuItemSelected.TypeImage);
            }
            else
            {
                pictureBoxTypeImage.Image = null;
            }
        }
Example #11
0
        public void Invoke(IExecutionContext context)
        {
            var result    = default(Object);
            var obj       = context.Pop();
            var arguments = new Object[_length];

            for (var i = 0; i < arguments.Length; i++)
            {
                arguments[i] = context.Pop();
            }

            if (obj != null)
            {
                var function = obj as Function;

                if (function != null || TypeFunctions.TryFind(obj, out function))
                {
                    result = function.Invoke(arguments);
                }
            }

            context.Push(result);
        }
Example #12
0
        /// <summary>
        /// SearchByParam
        /// </summary>
        ///<param name="pEvent">Event</param>
        ///<param name="pEndDate">pEndDate</param>
        /// <returns>LogsList</returns>
        /// <Date>2010-02-26T10:05:27</Date>
        /// <Author>moviedo</Author>
        public override Events SearchByParam(Event pEvent, DateTime pEndDate)
        {
            Events wEventList = new Events();
            Event  wEvent;

            using (SqlConnection wCnn = new SqlConnection(GetCnnString()))
                using (SqlCommand wCmd = new SqlCommand())
                {
                    try
                    {
                        wCnn.Open();
                        wCmd.Connection  = wCnn;
                        wCmd.CommandType = CommandType.StoredProcedure;
                        wCmd.CommandText = "fwk_Logs_s";
                        SqlParameter wParam = null;


                        if (!string.IsNullOrEmpty(pEvent.Source))
                        {
                            wParam       = wCmd.Parameters.Add("Source", SqlDbType.NVarChar);
                            wParam.Value = string.Concat("%", pEvent.Source, "%");
                        }



                        if (pEvent.LogType != EventType.None)
                        {
                            wParam       = wCmd.Parameters.Add("LogType", SqlDbType.NVarChar);
                            wParam.Value = pEvent.LogType;
                        }
                        if (pEvent.LogDate != Fwk.HelperFunctions.DateFunctions.NullDateTime)
                        {
                            wParam       = wCmd.Parameters.Add("LogDateDesde", SqlDbType.DateTime);
                            wParam.Value = pEvent.LogDate;
                        }

                        if (pEndDate != Fwk.HelperFunctions.DateFunctions.NullDateTime)
                        {
                            wParam       = wCmd.Parameters.Add("LogDateHasta", SqlDbType.DateTime);
                            wParam.Value = pEndDate;
                        }

                        if (!string.IsNullOrEmpty(pEvent.Machine))
                        {
                            wParam       = wCmd.Parameters.Add("Machine", SqlDbType.NVarChar);
                            wParam.Value = string.Concat("%", pEvent.Machine, "%");
                        }

                        if (!string.IsNullOrEmpty(pEvent.User))
                        {
                            wParam       = wCmd.Parameters.Add("UserLoginName", SqlDbType.NVarChar);
                            wParam.Value = string.Concat("%", pEvent.User, "%");
                        }

                        if (!string.IsNullOrEmpty(pEvent.AppId))
                        {
                            wParam       = wCmd.Parameters.Add("AppId", SqlDbType.NVarChar);
                            wParam.Value = string.Concat("%", pEvent.AppId, "%");
                        }



                        using (IDataReader reader = wCmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                wEvent    = new Event();
                                wEvent.Id = new Guid(reader["Id"].ToString());

                                wEvent.Message.Text = TypeFunctions.ConvertBytesToTextString((Byte[])(reader["Message"]));
                                wEvent.Source       = reader["Source"].ToString();
                                wEvent.LogType      = (EventType)Enum.Parse(typeof(EventType), reader["LogType"].ToString());
                                wEvent.Machine      = reader["Machine"].ToString();
                                wEvent.LogDate      = Convert.ToDateTime(reader["LogDate"]);
                                wEvent.User         = reader["UserLoginName"].ToString();
                                wEvent.AppId        = reader["AppId"].ToString();
                                wEventList.Add(wEvent);
                            }
                        }

                        return(wEventList);
                    }
                    catch (Exception ex)
                    {
                        TechnicalException te = new TechnicalException("Error de Fwk.Logging", ex);
                        te.ErrorId = "9004";
                        Fwk.Exceptions.ExceptionHelper.SetTechnicalException <DatabaseTarget>(te);
                        throw te;
                    }
                }
        }
Example #13
0
 public void UpdateValues(uint[] values)
 {
     Points = TypeFunctions.PointsFor(values, _type);
     OnValueChanged.Invoke();
 }
Example #14
0
 private void btnLoadLargeImage_Click(object sender, EventArgs e)
 {
     GetImage(pctLargeImage);
     _CopyButton.LargeImage = TypeFunctions.ConvertImageToByteArray(pctLargeImage.Image, ImageFormat.Png);
 }