Refresh() public method

public Refresh ( ) : void
return void
 /// <summary>
 /// Initializes a new instance of the <see cref="VisualTreeViewModel"/> class.
 /// </summary>
 public LogicalTreeViewModel()
 {
     _selectedTreeItemService = ServiceLocator.Resolve<SelectedTreeItemService>();
     var treeElementService = ServiceLocator.Resolve<LogicalTreeService>();
     Elements = new ListCollectionView(treeElementService.Elements);
     Elements.CurrentChanged += CurrentElementChanged;
     treeElementService.ElementsChanged += (s, e) => Elements.Refresh();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourcesViewModel"/> class.
        /// </summary>
        public ResourcesViewModel()
        {
            var selectedObjectService = ServiceLocator.Resolve<SelectedTreeItemService>();
            selectedObjectService.SelectedTreeItemChanged += OnSelectedObjectChanged;

            var resourcesService = ServiceLocator.Resolve<ResourcesService>();
            var resources = new ListCollectionView(resourcesService.ResourceItems);
            resources.CustomSort = new ResourceComparer();
            resources.Filter = ResourceFilter;
            Resources = resources;
            resourcesService.ResourcesListChanged += (s, e) => resources.Refresh();

            _updateTrigger.UpdateAction = () => resourcesService.UpdateResourceList(_selectedTreeItem);
        }
Esempio n. 3
0
        //-------------------------------------------------------------------------------
        public CharItemData(string path)
        {
            ReadSkillCastTimes();
            ReadItemsData(path);
            attribList.Clear();
            NonLocalMods.Clear();
            AttribCollectionView = new ListCollectionView(attribList);
            SetAttributes();

            PropertyGroupDescription pgd = new PropertyGroupDescription("Group");
            AttribCollectionView.GroupDescriptions.Add(pgd);
            AttribCollectionView.CustomSort = new NumberLessStringComparer();

            AttribCollectionView.Refresh();
        }
Esempio n. 4
0
        public CharItemData(POEApi.Model.EquipedItems equipped, List<POEApi.Model.Item> nonEquipped)
        {
            ReadSkillCastTimes();
            ReadItemsData(equipped);
            ReadItemsData(nonEquipped);
            attribList.Clear();
            NonLocalMods.Clear();
            AttribCollectionView = new ListCollectionView(attribList);
            SetAttributes();

            PropertyGroupDescription pgd = new PropertyGroupDescription("Group");
            AttribCollectionView.GroupDescriptions.Add(pgd);
            AttribCollectionView.CustomSort = new NumberLessStringComparer();

            AttribCollectionView.Refresh();
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventsViewModel"/> class.
        /// </summary>
        public EventsViewModel()
        {
            var selectedTreeItemService = ServiceLocator.Resolve<SelectedTreeItemService>();
            selectedTreeItemService.SelectedTreeItemChanged += OnSelectedTreeItemChanged;

            _eventTrackingService = ServiceLocator.Resolve<RoutedEventTrackingService>();

            // Event Handlers
            EventHandlers = new ListCollectionView(_eventTrackingService.RoutedEvents);
            EventHandlers.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            EventHandlers.GroupDescriptions.Add(new PropertyGroupDescription("Type"));
            _eventTrackingService.EventHandlersChanged += (s, e) => EventHandlers.Refresh();

            // Events
            Events = new ListCollectionView(_eventTrackingService.EventItems);
            _eventTrackingService.EventsChanged += (s, e) => Events.Refresh();

            _updateTrigger.UpdateAction = () => _eventTrackingService.UpdateRoutedEvents(_selectedTreeItem);
        }
Esempio n. 6
0
        public ItemAttributes(string itemData)
        {
            #region Readin

            RavenJObject jObject = RavenJObject.Parse(itemData);
            foreach (RavenJObject jobj in (RavenJArray) jObject["items"])
            {
                var html = jobj["x"].Value<string>();
                //html =
                //   html.Replace("\\\"", "\"").Replace("\\/", "/").Replace("\\n", " ").Replace("\\t", " ").Replace(
                //     "\\r", "").Replace("e\"", "e\" ").Replace("\"style", "\" style");
                var id = jobj["inventoryId"].Value<string>();
                if (id == "BodyArmour")
                {
                    AddItem(jobj, Item.ItemClass.Armor);
                }
                if (id == "Ring" || id == "Ring2")
                {
                    AddItem(jobj, Item.ItemClass.Ring);
                }
                if (id == "Gloves")
                {
                    AddItem(jobj, Item.ItemClass.Gloves);
                }
                if (id == "Weapon")
                {
                    AddItem(jobj, Item.ItemClass.MainHand);
                }
                if (id == "Offhand")
                {
                    AddItem(jobj, Item.ItemClass.OffHand);
                }
                if (id == "Helm")
                {
                    AddItem(jobj, Item.ItemClass.Helm);
                }
                if (id == "Boots")
                {
                    AddItem(jobj, Item.ItemClass.Boots);
                }
                if (id == "Amulet")
                {
                    AddItem(jobj, Item.ItemClass.Amulet);
                }
                if (id == "Belt")
                {
                    AddItem(jobj, Item.ItemClass.Belt);
                }
            }

            #endregion

            aList.Clear();
            NonLocalMods.Clear();
            Attributes = new ListCollectionView(aList);
            foreach (Item item in Equip)
            {
                foreach (var attr in item.Attributes)
                {
                    if (attr.Key == "Quality: #") continue;
                    aList.Add(new Attribute(attr.Key, attr.Value, item.Class.ToString()));
                }

                foreach (ItemMod mod in item.Mods)
                {
                    Attribute attTo = null;
                    attTo =
                        aList.Find(
                            ad =>
                                ad.TextAttribute == mod.Attribute &&
                                ad.Group == (mod.isLocal ? item.Class.ToString() : "Independent"));
                    if (attTo == null)
                    {
                        aList.Add(new Attribute(mod.Attribute, mod.Value,
                            (mod.isLocal ? item.Class.ToString() : "Independent")));
                    }
                    else
                    {
                        attTo.Add(mod.Attribute, mod.Value);
                    }
                }

                foreach (var attr in item.Attributes)
                {
                    if (attr.Key == "Quality: +#%") continue;
                    if (attr.Key == "Attacks per Second: #") continue;
                    if (attr.Key == "Critical Strike Chance: #%") continue;
                    if (attr.Key.ToLower().Contains("damage")) continue;
                    if (attr.Key.Contains("Weapon Class")) continue;
                    if (attr.Key.Contains("Elemental Damage")) continue;
                    Attribute attTo = null;
                    attTo = NonLocalMods.Find(ad => ad.TextAttribute == attr.Key);
                    if (attTo == null)
                    {
                        NonLocalMods.Add(new Attribute(attr.Key, attr.Value, ""));
                    }
                    else
                    {
                        attTo.Add(attr.Key, attr.Value);
                    }
                }

                foreach (ItemMod mod in item.Mods)
                {
                    if (mod.isLocal) continue;
                    Attribute attTo = null;
                    attTo = NonLocalMods.Find(ad => ad.TextAttribute == mod.Attribute);
                    if (attTo == null)
                    {
                        NonLocalMods.Add(new Attribute(mod.Attribute, mod.Value, ""));
                    }
                    else
                    {
                        attTo.Add(mod.Attribute, mod.Value);
                    }
                }
            }

            var pgd = new PropertyGroupDescription("");
            pgd.PropertyName = "Group";
            Attributes.GroupDescriptions.Add(pgd);
            Attributes.CustomSort = new NumberLessStringComparer();

            var itemsBinding = new Binding();

            Attributes.Refresh();
        }
        public KStudioService()
        {
            DebugHelper.AssertUIThread();

            KStudio.KStudioObjectInitializer = ObjectInitializer;

            this.settings = new KStudioServiceSettings();
            this.settings.PropertyChanged += (source, e) =>
            {
                if ((e != null) && (e.PropertyName == "AdvancedModeObscureStreams"))
                {
                    this.RaisePropertyChanged("TargetMonitorableStreamsTitle");
                    this.RaisePropertyChanged("TargetMonitorableStreamsToolTip");
                    this.RaisePropertyChanged("TargetRecordableStreamsTitle");
                    this.RaisePropertyChanged("TargetRecordableStreamsToolTip");
                    this.RaisePropertyChanged("PlaybackableStreamsTitle");
                    this.RaisePropertyChanged("PlaybackableStreamsToolTip");
                }
            };

            this.monitorTimer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromMilliseconds(250),
            };
            this.monitorTimer.Tick += MonitorTimer_Tick;

            this.targetAddress = IPAddress.Loopback;
            this.targetAlias = Environment.MachineName;

            this.client = KStudio.CreateClient(KStudioClientFlags.ProcessNotifications);
            this.client.PropertyChanged += this.Client_PropertyChanged;
            this.client.EventDataAvailable += this.Client_EventDataAvailable;

            // recordable streams

            ListCollectionView targetRecordableStreams = new ListCollectionView(client.EventStreams);
            targetRecordableStreams.Filter = (object item) =>
            {
                KStudioEventStream stream = item as KStudioEventStream;
                Debug.Assert(stream != null);

                return stream.IsRecordable && stream.IsFromService;
            };
            targetRecordableStreams.SortDescriptions.Clear();
            targetRecordableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending));
            targetRecordableStreams.Refresh();

            this.targetRecordableStreams = targetRecordableStreams;

            // playbackable streams

            ListCollectionView targetPlaybackableStreams = new ListCollectionView(client.EventStreams);
            targetPlaybackableStreams.Filter = (object item) =>
            {
                KStudioEventStream stream = item as KStudioEventStream;
                Debug.Assert(stream != null);

                return stream.IsPlaybackable && stream.IsFromService;
            };
            targetPlaybackableStreams.SortDescriptions.Clear();
            targetPlaybackableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending));
            targetPlaybackableStreams.Refresh();

            this.targetPlaybackableStreams = targetPlaybackableStreams;

            // monitorable streams

            ListCollectionView targetMonitorableStreams = new ListCollectionView(client.EventStreams);
            targetMonitorableStreams.Filter = (object item) =>
            {
                KStudioEventStream stream = item as KStudioEventStream;
                Debug.Assert(stream != null);

                return stream.IsMonitor && stream.IsFromService;
            };
            targetMonitorableStreams.SortDescriptions.Clear();
            targetMonitorableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending));
            targetMonitorableStreams.Refresh();

            this.targetMonitorableStreams = targetMonitorableStreams;
        }
Esempio n. 8
0
        private void RefreshItemAttributes()
        {
            NonLocalMods = (from item in Equip
                            from mod in SelectNonLocalMods(item)
                            group mod by mod.Attribute into modsForAttr
                            select modsForAttr.Aggregate((m1, m2) => m1.Sum(m2))
                           ).ToList();
            var aList = new List<Attribute>();
            var independent = new List<Attribute>();
            foreach (var item in Equip)
            {
                LoadItemAttributes(item, aList, independent);
            }
            aList.AddRange(independent);
            Attributes = new ListCollectionView(aList);

            var pgd = new PropertyGroupDescription("Group", new HeaderConverter());
            Attributes.GroupDescriptions.Add(pgd);

            Attributes.Refresh();
        }
Esempio n. 9
0
        private void RefreshItemAttributes()
        {
            aList.Clear();
            NonLocalMods.Clear();
            Attributes = new ListCollectionView(aList);
            foreach (Item item in Equip)
            {
                LoadItem(item, aList, NonLocalMods);
            }

            var pgd = new PropertyGroupDescription("");
            pgd.PropertyName = "Group";
            Attributes.GroupDescriptions.Add(pgd);
            Attributes.CustomSort = new NumberLessStringComparer();

            Attributes.Refresh();
        }
        public void SetupForPlayback(ReadOnlyObservableCollection<KStudioEventStream> clientEventStreams)
        {
            DebugHelper.AssertUIThread();

            if ((this.livePlaybackStreams == null) && (clientEventStreams != null))
            {
                ListCollectionView targetPlaybackableStreams = new ListCollectionView(clientEventStreams);
                targetPlaybackableStreams.Filter = (object item) =>
                    {
                        KStudioEventStream s = item as KStudioEventStream;
                        Debug.Assert(s != null);

                        return s.IsPlaybackable && s.IsFromService && (s.DataTypeId == this.stream.DataTypeId);
                    };
                targetPlaybackableStreams.SortDescriptions.Clear();
                targetPlaybackableStreams.SortDescriptions.Add(new SortDescription("UserState.ShortNameUppercase", ListSortDirection.Ascending));
                targetPlaybackableStreams.Refresh();

                this.livePlaybackStreams = targetPlaybackableStreams;
                this.RaisePropertyChanged("LivePlaybackStreams");
            }
        }
Esempio n. 11
0
        public MainWindow()
        {
            InitializeComponent();

            this.SourceInitialized += new EventHandler(MainWindow_SourceInitialized);

            SlideFade.StartAnimationIn(this);

            view = new ListCollectionView(App.Instance.OpenChats);
            view.SortDescriptions.Add(new System.ComponentModel.SortDescription("LastMessage", System.ComponentModel.ListSortDirection.Descending));
            view.SortDescriptions.Add(new System.ComponentModel.SortDescription("NewMessages", System.ComponentModel.ListSortDirection.Descending));
            view.SortDescriptions.Add(new System.ComponentModel.SortDescription("NickName", System.ComponentModel.ListSortDirection.Ascending));
            view.Refresh();

            this.listbox1.ItemsSource = view;
            //listbox1.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("NewMessages", System.ComponentModel.ListSortDirection.Descending));
            //listbox1.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("NickName", System.ComponentModel.ListSortDirection.Ascending));

            dialog = new Microsoft.Win32.OpenFileDialog();
            dialog.Filter = "Image Files|*.png;*.jpg;*.bmp;*.jpeg";
            dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            dialog.FileOk += new CancelEventHandler(dialog_FileOk);

            try
            {
                int Width = Convert.ToInt32(ConfigManager.Instance.GetString("WndWidth", this.Width.ToString()));
                int Height = Convert.ToInt32(ConfigManager.Instance.GetString("WndHeight", this.Height.ToString()));

                if (Width >= SystemParameters.WorkArea.Width || Height >= SystemParameters.WorkArea.Height)
                    return;

                this.Width = Width;
                this.Height = Height;
            }
            catch { }
        }
        public MediaFileStateCollectionView(MediaFileState mediaState = null) :
            base(mediaState)
        {           
            Filter = filterFunc;
            InfoIconsCache = InfoIconsCacheStatic;

            MediaFilter = MediaFilterMode.None;           

            SortFunc = MediaFileSortFunctions.getSortFunction(MediaFileSortMode.Name);
            SortMode = MediaFileSortMode.Name;
            
            FilterModes = new ListCollectionView(Enum.GetValues(typeof(MediaFilterMode)));

            SortItemCollection<MediaFileSortItem, MediaFileSortMode> mediaFileSortItemCollection = new SortItemCollection<MediaFileSortItem,MediaFileSortMode>();
            mediaFileSortItemCollection.ItemSortDirectionChanged += mediaFileSortItemCollection_ItemSortDirectionChanged;

            foreach(MediaFileSortMode mode in Enum.GetValues(typeof(MediaFileSortMode))) {

                mediaFileSortItemCollection.Add(new MediaFileSortItem(mode));
            }

            SortModes = new ListCollectionView(mediaFileSortItemCollection);
         
            SortModes.CurrentChanged += (s, e) =>
            {
                MediaFileSortItem sortItem = (MediaFileSortItem)SortModes.CurrentItem;

                SortMode = sortItem.SortMode;
                SortDirection = sortItem.SortDirection;

                SortFunc = MediaFileSortFunctions.getSortFunction(SortMode);

                refresh();
            };

            SortModes.Filter = mediaStateSortModeCollectionViewFilter;

            FilterModes.CurrentChanged += (s, e) =>
            {
                MediaFilter = (MediaFilterMode)FilterModes.CurrentItem;
                              
                SortModes.Refresh();

                bool isRefreshed = false;

                switch (MediaFilter)
                {
                    case MediaFilterMode.None:
                        if (!MediaFileSortFunctions.isAllSortMode(SortMode))
                        {
                            SortModes.MoveCurrentToFirst();
                            isRefreshed = true;
                        }
                        break;
                    case MediaFilterMode.Video:
                        if (!MediaFileSortFunctions.isVideoSortMode(SortMode))
                        {
                            SortModes.MoveCurrentToFirst();
                            isRefreshed = true;
                        }
                        break;
                    case MediaFilterMode.Images:
                        if (!MediaFileSortFunctions.isImageSortMode(SortMode))
                        {
                            SortModes.MoveCurrentToFirst();
                            isRefreshed = true;
                        }
                        break;
                    case MediaFilterMode.Audio:
                        if (!MediaFileSortFunctions.isAudioSortMode(SortMode))
                        {
                            SortModes.MoveCurrentToFirst();
                            isRefreshed = true;
                        }
                        break;
                    default:
                        break;
                }

                if (!isRefreshed)
                {
                    refresh();
                }
       
            };
                                    
            FilterModes.MoveCurrentTo(MediaFilterMode.None);
            
        }