internal PatchScriptManagerProcessingInputValueEventArgs(InputValueType valueType, string titel, RomManager romManager, IWin32Window owner)
 {
     ValueType   = valueType;
     Titel       = titel;
     RomManager  = romManager;
     Owner       = owner;
     SettedValue = false;
 }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(DependencyProperty.UnsetValue);
            }
            InputValueType valueType = (InputValueType)value;

            return(valueType == InputValueType.Text);
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            InputValueType valueType = InputValueType.Text;

            if (value == null)
            {
                return(valueType);
            }
            bool isInputMethodEnable = (bool)value;

            if (!isInputMethodEnable)
            {
                valueType = InputValueType.Number;
            }
            return(valueType);
        }
Пример #4
0
        ///// <summary>
        ///// 初始化对象
        ///// </summary>
        //public FilterValueEventArgs()
        //{
        //}

        /// <summary>
        /// 初始化对象
        /// </summary>
        /// <param name="source">数据来源</param>
        /// <param name="type">数据类型</param>
        /// <param name="Value">要处理的数据</param>
        public FilterValueEventArgs(InputValueSource source, InputValueType type, object Value)
        {
            this._Source = source;
            this._Type   = type;
            this._Value  = Value;
        }
Пример #5
0
 public InputValue(float value, InputValueType type)
 {
     this.value = value;
     this.type  = type;
 }
Пример #6
0
        public async Task <IActionResult> RegisterSearchValue(string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(BadRequest("Value provided is not valid."));
            }

            InputValueType valueType      = CommonFunctions.ValidateValueType(value);
            string         allWordsInPage = null;
            string         url            = null;
            Content        content        = null;

            switch (valueType)
            {
            case InputValueType.URL:

                if (!CommonFunctions.IsUrlResponses(value))
                {
                    return(BadRequest("Unable to get response from URL given."));
                }

                url     = value;
                content = _contentService.GetByUrl(url);
                if (content != null)
                {
                    //if content is more than 1 days old, update latest content
                    if (content.UpdatedDate < DateTime.Now.AddDays(-1))
                    {
                        allWordsInPage = await CommonFunctions.GetPageWordsFromUrl(url);

                        content = _contentService.Update(content.Id, url, allWordsInPage);
                    }
                }
                else
                {
                    allWordsInPage = await CommonFunctions.GetPageWordsFromUrl(url);

                    content = _contentService.Save(url, allWordsInPage);
                }

                break;

            case InputValueType.TEXT:
                allWordsInPage = value;
                content        = _contentService.GetByValue(value);

                if (content != null)
                {
                    //if content is more than 1 days old, update latest content
                    if (content.UpdatedDate < DateTime.Now.AddDays(-1))
                    {
                        content = _contentService.Update(content.Id, url, allWordsInPage);
                    }
                }
                else
                {
                    content = _contentService.Save(url, allWordsInPage);
                }

                break;

            default:
                break;
            }

            return(Json(content.Id));
        }
Пример #7
0
        public InputDialog(InputValueType valType, RomManager rommgr, object defaultValue = null)
        {
            InitializeComponent();
            ValueType   = valType;
            this.rommgr = rommgr;

            string infoText = string.Empty;

            switch (valType)
            {
            case InputValueType.Byte:
                infoText = "Input a 8 Bit value (Byte)";
                break;

            case InputValueType.UInt16:
                infoText = "Input a 16 Bit value (2 Bytes)";
                break;

            case InputValueType.UInt32:
                infoText = "Input a 32 Bit value (4 Bytes)";
                break;

            case InputValueType.Single:
                infoText = "Input a float value";
                break;

            case InputValueType.String:
                infoText = "Input a string";
                break;

            case InputValueType.Sequence:
                infoText = "Input a Sequence ID";
                break;

            case InputValueType.LevelID:
                infoText = "Input a Level ID";
                break;
            }

            switch (valType)
            {
            case InputValueType.Byte:
            case InputValueType.UInt16:
            case InputValueType.UInt32:
            {
                ComboBoxEx1.Text = defaultValue is null ? "0" : TextValueConverter.TextFromValue(Conversions.ToLong(defaultValue));
                break;
            }

            case InputValueType.Single:
            {
                ComboBoxEx1.Text = $"0{CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator}00";
                break;
            }

            case InputValueType.String:
            {
                ComboBoxEx1.Text = Conversions.ToString(defaultValue is null ? "Text" : defaultValue);
                break;
            }

            case InputValueType.Sequence:
            {
                if (rommgr is object)
                {
                    byte id = 0;
                    foreach (MusicSequence ms in rommgr.MusicList)
                    {
                        ComboBoxEx1.Items.Add($"{id.ToString("X2")} - {ms.Name}");
                        id += 1;
                    }

                    ComboBoxEx1.DropDownStyle = ComboBoxStyle.DropDownList;
                    ComboBoxEx1.SelectedIndex = 0;
                }

                break;
            }

            case InputValueType.LevelID:
            {
                if (rommgr is object)
                {
                    foreach (SM64Lib.Levels.LevelInfoDataTabelList.Level lvi in rommgr.LevelInfoData)
                    {
                        ComboBoxEx1.Items.Add($"{lvi.ID.ToString("X2")} - {lvi.Name}");
                    }
                    ComboBoxEx1.DropDownStyle = ComboBoxStyle.DropDownList;
                    ComboBoxEx1.SelectedIndex = 0;
                }

                break;
            }
            }

            if (infoText != null)
            {
                LabelX1.Text = infoText;
            }

            base.UpdateAmbientColors();
        }