public override void HandleSettings(JObject settings, SettingsAction action)
    {
        base.HandleSettings(settings, action);

        if (action == SettingsAction.Saving)
        {
            if (OutputDirectory != null)
            {
                settings[nameof(OutputDirectory)] = JValue.FromObject(OutputDirectory);
            }
            settings[nameof(ScriptType)]  = new JValue(ScriptType);
            settings[nameof(EnabledAxes)] = JArray.FromObject(EnabledAxes);
        }
        else if (action == SettingsAction.Loading)
        {
            if (settings.TryGetValue <DirectoryInfo>(nameof(OutputDirectory), out var outputDirectory))
            {
                OutputDirectory = outputDirectory;
            }
            if (settings.TryGetValue <ScriptType>(nameof(ScriptType), out var scriptType))
            {
                ScriptType = scriptType;
            }
            if (settings.TryGetValue <List <DeviceAxis> >(nameof(EnabledAxes), out var enabledAxes))
            {
                EnabledAxes = new ObservableConcurrentCollection <DeviceAxis>(enabledAxes); //TODO: does not update ui
            }
        }
    }
Пример #2
0
        public BindableSink(IFormatProvider formatProvider = null)
        {
            _formatProvider = formatProvider;

            Events = new ObservableConcurrentCollection <string>();
            Events.PropertyChanged   += OnPropertyChanged;
            Events.CollectionChanged += OnCollectionChanged;
        }
Пример #3
0
 public ConnectionTesterWindow()
 {
     InitializeComponent();
     consoleHistory            = new ObservableConcurrentCollection <string>();
     totalTimer                = new DispatcherTimer();
     milisecondTimer           = new DispatcherTimer();
     ConsoleOutput.ItemsSource = consoleHistory;
 }
    public SerialOutputTargetViewModel(int instanceIndex, IEventAggregator eventAggregator, IDeviceAxisValueProvider valueProvider)
        : base(instanceIndex, eventAggregator, valueProvider)
    {
        SerialPorts         = new ObservableConcurrentCollection <SerialPortInfo>();
        _cancellationSource = new CancellationTokenSource();

        _ = RefreshPorts();
    }
Пример #5
0
    public ApplicationViewModel(IEventAggregator eventAggregator)
    {
        eventAggregator.Subscribe(this);

        LogLevels = new ObservableConcurrentCollection <LogLevel>(LogLevel.AllLevels);

        var devices = SettingsHelper.Read(SettingsType.Devices).Properties().Select(p => p.Name);

        DeviceTypes = new ObservableConcurrentCollection <string>(devices);
    }
Пример #6
0
        public Window1()
        {
            InitializeComponent();

            // intialize the bindable collection and set it as the data context
            var orders = new ObservableConcurrentCollection <PizzaOrder>();

            // store the observable collection as an explicity producer consumer
            // collection that has tryadd and tryremove operations
            m_orders = orders;
            // set the AcmePizza as the defaut
            this.DataContext = orders;
        }
    public FileOutputTargetViewModel(int instanceIndex, IEventAggregator eventAggregator, IDeviceAxisValueProvider valueProvider)
        : base(instanceIndex, eventAggregator, valueProvider)
    {
        EnabledAxes = new ObservableConcurrentCollection <DeviceAxis>();
        EnabledAxes.PropertyChanged += (s, e) =>
        {
            if (e.PropertyName == "Count")
            {
                NotifyOfPropertyChange(nameof(CanToggleConnect));
            }
        };

        UpdateInterval = 20;
    }
Пример #8
0
        public Bot(GameSession session, EventPipeline eventPipeline)
        {
            Session            = session;
            this.eventPipeline = eventPipeline;

            Monsters            = new ObservableConcurrentCollection <Monster>();
            WhitelistedMonsters = new ObservableConcurrentCollection <Monster>();

            DamageSkills = new ObservableConcurrentCollection <Skill>();
            BuffSkills   = new ObservableConcurrentCollection <Skill>();

            UsedBuffSkills   = new ObservableConcurrentCollection <Skill>();
            UsedDamageSkills = new ObservableConcurrentCollection <Skill>();

            HealItems     = new ObservableConcurrentCollection <ItemConfiguration>();
            UsedHealItems = new ObservableConcurrentCollection <ItemConfiguration>();

            Path = new ObservableConcurrentCollection <Position>();
        }
 public IShortcutSettingBuilder <T> WithItemsSource(IEnumerable <T> itemsSource)
 {
     _itemsSource = new ObservableConcurrentCollection <T>(itemsSource); return(this);
 }
Пример #10
0
 public MediaResourceFactory()
 {
     PathModifiers = new ObservableConcurrentCollection <IMediaPathModifier>();
 }
Пример #11
0
 public ConnectionTester(int connectionNumber, int timeRange, ObservableConcurrentCollection <string> output)
 {
     _connectionNumber = connectionNumber;
     _timeRange        = timeRange;
     _output           = output;
 }