Example #1
0
        public static void Load(GenericPropertyCollection properties, string fileName)
        {
            var contents         = File.ReadAllText(fileName, Encoding.UTF8);
            var jArrayProperties = JArray.Parse(contents);

            GenericPropertySerializer.DeserializePropertiesFromArray(properties, jArrayProperties);
        }
Example #2
0
        public virtual void Initialize()
        {
            Api = new BinanceApi();

            var apiKey    = genericProperties.Get(SettingName.API_KEY, string.Empty);
            var secretKey = genericProperties.Get(SettingName.SECRET_KEY, string.Empty);

            if (!string.IsNullOrEmpty(apiKey) && !string.IsNullOrEmpty(secretKey))
            {
                User = new BinanceApiUser(apiKey, secretKey);
            }

            var jArrayProperties = SettingsHelper.GetJArrayHuntingProperties(TypeName);

            if (jArrayProperties != null)
            {
                GenericPropertySerializer.DeserializePropertiesFromArray(Properties, jArrayProperties);
            }
        }
        public static GenericPropertyCollection GetGeneralProperties()
        {
            var properties = new GenericPropertyCollection()
            {
                new GenericProperty()
                {
                    Browsable    = true,
                    Name         = SettingName.API_KEY,
                    DisplayName  = "Api Key",
                    DefaultValue = string.Empty,
                    Type         = GenericPropertyType.String
                },
                new GenericProperty()
                {
                    Browsable    = true,
                    Name         = SettingName.SECRET_KEY,
                    DisplayName  = "Secret Key",
                    DefaultValue = string.Empty,
                    Type         = GenericPropertyType.String
                },
                new GenericProperty()
                {
                    Browsable    = true,
                    Name         = SettingName.TRADING_ENABLED,
                    DisplayName  = "Trading Enable",
                    DefaultValue = false,
                    Type         = GenericPropertyType.Boolean
                }
            };

            var jArrayProperties = GetJArrayGeneralProperties();

            if (jArrayProperties != null)
            {
                GenericPropertySerializer.DeserializePropertiesFromArray(properties, jArrayProperties);
            }

            return(properties);
        }
Example #4
0
        private void FormSettings_Load(object sender, EventArgs e)
        {
            // general properties
            genericPropertyListControl.Properties = SettingsHelper.GetGeneralProperties();
            genericPropertyListControl.RefreshItems();

            // hunting properties
            var huntingTypes = HuntingTypeManager.Instance.HuntingTypes;

            foreach (var huntingType in huntingTypes)
            {
                var properties       = huntingType.GetProperties();
                var jArrayProperties = SettingsHelper.GetJArrayHuntingProperties(huntingType.TypeName);
                if (jArrayProperties != null)
                {
                    GenericPropertySerializer.DeserializePropertiesFromArray(properties, jArrayProperties);
                }

                var tabPage = new TabPage()
                {
                    Text = huntingType.DisplayName,
                    Tag  = huntingType
                };

                var propertyControl = new GenericPropertyListControl
                {
                    Dock       = DockStyle.Fill,
                    Properties = properties
                };
                propertyControl.Options.ViewMode = ViewMode.CategoryList;

                tabPage.Controls.Add(propertyControl);
                tabControl.TabPages.Add(tabPage);

                propertyControl.RefreshItems();
            }
        }