Ejemplo n.º 1
0
        public MainGridModel(ISynchronizeInvoke synchronizeInvoke, IPreferences preferences, ClientConfiguration clientConfiguration)
        {
            _synchronizeInvoke  = synchronizeInvoke;
            Preferences         = preferences ?? new InMemoryPreferencesProvider();
            ClientConfiguration = clientConfiguration;

            _slotList = new SlotModelSortableBindingList();
            _slotList.RaiseListChangedEvents = false;
            BindingSource = new BindingSource();
        }
Ejemplo n.º 2
0
        public MainGridModel(IPreferenceSet prefs, ISynchronizeInvoke syncObject, IClientConfiguration clientConfiguration)
        {
            _prefs                       = prefs;
            _syncObject                  = syncObject;
            _clientConfiguration         = clientConfiguration;
            _slotList                    = new SlotModelSortableBindingList(_syncObject);
            _slotList.OfflineClientsLast = _prefs.Get <bool>(Preference.OfflineLast);
            _slotList.Sorted            += (sender, e) =>
            {
                SortColumnName = e.Name;
                _prefs.Set(Preference.FormSortColumn, SortColumnName);
                SortColumnOrder = e.Direction;
                _prefs.Set(Preference.FormSortOrder, SortColumnOrder);
            };
            _bindingSource                     = new BindingSource();
            _bindingSource.DataSource          = _slotList;
            _bindingSource.CurrentItemChanged += (sender, args) => SelectedSlot = (SlotModel)_bindingSource.Current;
#if DEBUG
            _slotList.ListChanged      += (s, e) => Debug.WriteLine("BindingList: " + e.ListChangedType);
            _bindingSource.ListChanged += (s, e) => Debug.WriteLine("BindingSource: " + e.ListChangedType);
#endif
            // Subscribe to PreferenceSet events
            _prefs.PreferenceChanged += (s, e) =>
            {
                switch (e.Preference)
                {
                case Preference.OfflineLast:
                    _slotList.OfflineClientsLast = _prefs.Get <bool>(Preference.OfflineLast);
                    Sort();
                    break;

                case Preference.PpdCalculation:
                case Preference.DecimalPlaces:
                case Preference.BonusCalculation:
                    ResetBindings();
                    break;
                }
            };

            // Subscribe to ClientDictionary events
            _clientConfiguration.DictionaryChanged += (sender, args) => ResetBindings();
        }
Ejemplo n.º 3
0
        public MainGridModel(IPreferenceSet prefs, ISynchronizeInvoke syncObject, IClientDictionary clientDictionary)
        {
            _prefs = prefs;
             _syncObject = syncObject;
             _clientDictionary = clientDictionary;
             _slotList = new SlotModelSortableBindingList(_syncObject);
             _slotList.OfflineClientsLast = _prefs.Get<bool>(Preference.OfflineLast);
             _slotList.Sorted += (sender, e) =>
                             {
                                SortColumnName = e.Name;
                                _prefs.Set(Preference.FormSortColumn, SortColumnName);
                                SortColumnOrder = e.Direction;
                                _prefs.Set(Preference.FormSortOrder, SortColumnOrder);
                             };
             _bindingSource = new BindingSource();
             _bindingSource.DataSource = _slotList;
             _bindingSource.CurrentItemChanged += delegate
                                              {
                                                 SelectedSlot = (SlotModel)_bindingSource.Current;
                                              };
            #if DEBUG
             _slotList.ListChanged += (s, e) =>
                                  {
                                     Debug.WriteLine("BindingList: " + e.ListChangedType);
                                  };
             _bindingSource.ListChanged += (s, e) =>
                                       {
                                          Debug.WriteLine("BindingSource: " + e.ListChangedType);
                                       };
            #endif
             // Subscribe to PreferenceSet events
             _prefs.OfflineLastChanged += delegate
                                      {
                                         _slotList.OfflineClientsLast = _prefs.Get<bool>(Preference.OfflineLast);
                                         Sort();
                                      };
             _prefs.PpdCalculationChanged += delegate { ResetBindings(); };
             _prefs.DecimalPlacesChanged += delegate { ResetBindings(); };
             _prefs.CalculateBonusChanged += delegate { ResetBindings(); };

             // Subscribe to ClientDictionary events
             _clientDictionary.DictionaryChanged += delegate { ResetBindings(); };
             _clientDictionary.ClientDataInvalidated += delegate { ResetBindings(); };
        }
Ejemplo n.º 4
0
      public MainGridModel(IPreferenceSet prefs, ISynchronizeInvoke syncObject, IClientConfiguration clientConfiguration)
      {
         _prefs = prefs;
         _syncObject = syncObject;
         _clientConfiguration = clientConfiguration;
         _slotList = new SlotModelSortableBindingList(_syncObject);
         _slotList.OfflineClientsLast = _prefs.Get<bool>(Preference.OfflineLast);
         _slotList.Sorted += (sender, e) =>
                             {
                                SortColumnName = e.Name;
                                _prefs.Set(Preference.FormSortColumn, SortColumnName);
                                SortColumnOrder = e.Direction;
                                _prefs.Set(Preference.FormSortOrder, SortColumnOrder);
                             };
         _bindingSource = new BindingSource();
         _bindingSource.DataSource = _slotList;
         _bindingSource.CurrentItemChanged += (sender, args) => SelectedSlot = (SlotModel)_bindingSource.Current;
#if DEBUG
         _slotList.ListChanged += (s, e) => Debug.WriteLine("BindingList: " + e.ListChangedType);
         _bindingSource.ListChanged += (s, e) => Debug.WriteLine("BindingSource: " + e.ListChangedType);
#endif
         // Subscribe to PreferenceSet events
         _prefs.PreferenceChanged += (s, e) =>
                                     {
                                        switch (e.Preference)
                                        {
                                           case Preference.OfflineLast:
                                              _slotList.OfflineClientsLast = _prefs.Get<bool>(Preference.OfflineLast);
                                              Sort();
                                              break;
                                           case Preference.PpdCalculation:
                                           case Preference.DecimalPlaces:
                                           case Preference.BonusCalculation:
                                              ResetBindings();
                                              break;
                                        }

                                     };

         // Subscribe to ClientDictionary events
         _clientConfiguration.DictionaryChanged += (sender, args) => ResetBindings();
      }