public ContactViewModel(BusinessCoreService businessCoreService, ConversationViewModel conversation)
        {
            _businessCoreService = businessCoreService;
            _conversation = conversation;
            IsSelected = false;

            CvsStaff = new CollectionViewSource { Source = _businessCoreService.GetContacts() };
            GroupDescription gp = new PropertyGroupDescription("OrganizationId");
            SortDescription sp = new SortDescription("OrganizationId", ListSortDirection.Ascending);
            CvsStaff.GroupDescriptions.Add(gp);
            CvsStaff.SortDescriptions.Add(sp);
     
            CvsStaff.Filter += ApplyFilter;

            var treeSource = _businessCoreService.GetOrganizationTreeNoChildren();
            var data = new ObservableCollection<OrganizationTreeInfoViewModel>();
            foreach (var item in treeSource)
            {
                data.Add(new OrganizationTreeInfoViewModel(item, _businessCoreService));
            }

            var result = GetOrganizationTree(data.Where(x => x.Info.ParentId == null).ToList(), data);
            _organizationTreeSource = new ObservableCollection<OrganizationTreeInfoViewModel>(result);
            OrganizationTreeCvsStaff = new CollectionViewSource { Source = _organizationTreeSource };

            Subscription.DoSelectedTree(SelectedUsersCallback);
        }
        public Options13_Language() {
            InitializeComponent();

            // This goes in the constructor rather than InitializeConfig because it should
            // not be affected by Apply.
            string[] metatags = {
                "Author",
                "Language",
                "Country",
                "Version_QTTabBar",
                "Version_LangFile",
                "DateModified"
            };
            LangItems.Add(new LangEntry("Author", -1));
            LangItems.Add(new LangEntry("Language", -1));
            LangItems.Add(new LangEntry("Country", -1));
            foreach(var kv in QTUtility.TextResourcesDic.OrderBy(kv => kv.Key)) {
                if(metatags.Contains(kv.Key)) continue;
                for(int i = 0; i < kv.Value.Length; i++) {
                    LangItems.Add(new LangEntry(kv.Key, i));
                }
            }

            ICollectionView view = CollectionViewSource.GetDefaultView(LangItems);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Location");
            view.GroupDescriptions.Add(groupDescription);
            lvwLangEditor.ItemsSource = view;
        }
        public PageManufacturer(Manufacturer manufacturer)
        {
            this.NumberOfAirliners = new List<int>();

            for (int i = 1; i <= 50; i++)
                this.NumberOfAirliners.Add(i);

            this.Manufacturer = manufacturer;

            this.Orders = new AirlinerOrdersMVVM();

            this.Airliners = new ObservableCollection<AirlinerType>();
            AirlinerTypes.GetTypes(a => a.Manufacturer == manufacturer && a.Produced.From <= GameObject.GetInstance().GameTime && a.Produced.To >= GameObject.GetInstance().GameTime).ForEach(t => this.Airliners.Add(t));
            this.DataContext = this.Airliners;

            this.Contract = new ManufacturerContractMVVM(this.Manufacturer, GameObject.GetInstance().HumanAirline.Contract != null ? GameObject.GetInstance().HumanAirline.Contract.Manufacturer : null);

            InitializeComponent();

            lvAirliners.ItemsSource = this.Airliners;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvAirliners.ItemsSource);
            view.GroupDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("AirlinerFamily");
            view.GroupDescriptions.Add(groupDescription);
        }
        public override void InitializeConfig() {
            int[] keys = WorkingConfig.keys.Shortcuts;
            HotkeyEntries = new List<HotkeyEntry>();
            for(int i = 0; i < (int)BindAction.KEYBOARD_ACTION_COUNT; ++i) {
                HotkeyEntries.Add(new HotkeyEntry(keys, i));
            }

            var PluginShortcuts = new Dictionary<string, int[]>();
            foreach(var info in PluginManager.PluginInformations) {
                Plugin p;
                if(!PluginManager.TryGetStaticPluginInstance(info.PluginID, out p) || !p.PluginInformation.Enabled) continue;
                string[] actions = null;
                try {
                    if(!p.Instance.QueryShortcutKeys(out actions)) actions = null;
                }
                catch {
                }
                if(actions == null) continue;
                if(WorkingConfig.keys.PluginShortcuts.TryGetValue(info.PluginID, out keys)) {
                    Array.Resize(ref keys, actions.Length);
                    PluginShortcuts[info.PluginID] = keys;
                }
                else {
                    PluginShortcuts[info.PluginID] = new int[actions.Length];
                }
                HotkeyEntries.AddRange(actions.Select((act, i) => new HotkeyEntry(keys, i, act, p.PluginInformation.Name)));
            }
            WorkingConfig.keys.PluginShortcuts = PluginShortcuts;

            ICollectionView view = CollectionViewSource.GetDefaultView(HotkeyEntries);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("PluginName");
            view.GroupDescriptions.Add(groupDescription);
            lvwHotkeys.ItemsSource = view;
        }
 private void AddGrouping(object sender, RoutedEventArgs args)
 {
     // This groups the items in the view by the property "Category"
     PropertyGroupDescription groupDescription = new PropertyGroupDescription();
     groupDescription.PropertyName = "Category";
     listingDataView.GroupDescriptions.Add(groupDescription);
 }
        void client_GetLogsCompleted(object sender, GetLogsCompletedEventArgs e)
        {
            Dispatcher.BeginInvoke(() =>
                {
                    var taskListView = new PagedCollectionView(e.Result);
                    if (taskListView.CanGroup)
                    {
                        if (cbGroupByIndend.IsChecked.HasValue && cbGroupByIndend.IsChecked.Value)
                        {
                            var group = new PropertyGroupDescription();
                            group.PropertyName = "IndentLevel";
                            taskListView.GroupDescriptions.Add(group);
                        }

                        if (cbGroupByMessage.IsChecked.HasValue && cbGroupByMessage.IsChecked.Value)
                        {
                            var group = new PropertyGroupDescription();
                            group.PropertyName = "Message";
                            taskListView.GroupDescriptions.Add(group);
                        }

                    }

                    logEntryEventArgsDataGrid.ItemsSource = taskListView;
                    if(!string.IsNullOrWhiteSpace(searchBox.txtSearchCriteria.Text))
                    {
                        SearchBox_Search(null, new SearchCriteriaEventArgs(searchBox.txtSearchCriteria.Text));
                    }

                    waitCursor.IsWaitEnable = false;
                });
        }
        private void Load(object sender, RoutedEventArgs e)
        {
            String profID = "76561198034183306";
            ItemSchema items = ItemSchema.GetFromFile();
            PriceSchema prices = PriceSchema.GetFromFile();
            Backpack bp = Backpack.GetFromFile(profID);
            bp.LoadSchema(items);
            try
            {
                bp.LoadPrices(items, prices);
            } catch(Exception f)
            {
                MessageBox.Show(f.Message);
            }
            DisplayItem.Schema = items;
            listView.ItemsSource = bp.Items.Select(i => new DisplayItem(i));
            GridView gridView = (listView.View as GridView);

            // This variable will hold the longest string from the source list.
            string longestItem = bp.Items.OrderByDescending(s => s.Name.Length).First().Name;
            string longestQuality = ((Quality[])Enum.GetValues(typeof(Quality))).OrderByDescending(s => s.ToString().Length).First().ToString();
            ResizeGridViewColumn(longestQuality, gridView.Columns[0]);
            //ResizeGridViewColumn(longestItem, gridView.Columns[1]);

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listView.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("PageName");
            view.GroupDescriptions.Add(groupDescription);
        }
Exemple #8
0
 private void AddGrouping(object sender, RoutedEventArgs e)
 {
     _myView = (CollectionView) CollectionViewSource.GetDefaultView(myItemsControl.ItemsSource);
     if (_myView.CanGroup)
     {
         var groupDescription
             = new PropertyGroupDescription("@Type");
         _myView.GroupDescriptions.Add(groupDescription);
     }
 }
        public ComplexSampleMeansProperties(
            DashboardHelper dashboardHelper, 
            IGadget gadget,
            ComplexSampleMeansParameters parameters,
            List<Grid> strataGridList
            )
        {
            InitializeComponent();
            this.DashboardHelper = dashboardHelper;
            this.Gadget = gadget;
            this.Parameters = parameters;

            List<string> fields = new List<string>();
            List<FieldInfo> items = new List<FieldInfo>();
            List<string> crosstabFields = new List<string>();
            List<string> strataFields = new List<string>();

            crosstabFields.Add(string.Empty);
            items.Add(new FieldInfo()
            {
                Name = "",
                DataType = "",
                VariableCategory = VariableCategory.Field
            });

            foreach (string fieldName in DashboardHelper.GetFieldsAsList())
            {
                items.Add(new FieldInfo()
                {
                    Name = fieldName,
                    DataType = DashboardHelper.GetColumnDbType(fieldName).ToString(),
                    VariableCategory = VariableCategory.Field
                });

                fields.Add(fieldName);
                crosstabFields.Add(fieldName);
                strataFields.Add(fieldName);
            }
            fields.Sort();
            crosstabFields.Sort();

            cbxField.ItemsSource = fields;
            cbxFieldWeight.ItemsSource = fields;
            cbxFieldCrosstab.ItemsSource = crosstabFields;
            cbxFieldStrata.ItemsSource = strataFields;
            cbxFieldPSU.ItemsSource = strataFields;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(cbxField.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory");
            view.GroupDescriptions.Add(groupDescription);

            RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as ComplexSampleMeansControl).DataFilters, true);
            RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelFilters.Children.Add(RowFilterControl);
        }
        public PageAirlineServices(AirlineMVVM airline)
        {
            this.Classes = new ObservableCollection<AirlineClassMVVM>();

            foreach (AirlinerClass.ClassType type in Enum.GetValues(typeof(AirlinerClass.ClassType)))
            {
                if ((int)type <= GameObject.GetInstance().GameTime.Year)
                {
                    AirlineClassMVVM rClass = new AirlineClassMVVM(type);

                    foreach (RouteFacility.FacilityType facilityType in Enum.GetValues(typeof(RouteFacility.FacilityType)))
                    {
                        if (GameObject.GetInstance().GameTime.Year >= (int)facilityType)
                        {
                            AirlineClassFacilityMVVM facility = new AirlineClassFacilityMVVM(facilityType);

                            facility.Facilities.Clear();

                            foreach (RouteFacility rFacility in AirlineHelpers.GetRouteFacilities(GameObject.GetInstance().HumanAirline, facilityType))
                                facility.Facilities.Add(rFacility);

                            facility.SelectedFacility = RouteFacilities.GetBasicFacility(facility.Type);//GetFacilities(rFacility.Type).OrderBy(f => f.ServiceLevel).First();

                            rClass.Facilities.Add(facility);
                        }
                    }
                    this.Classes.Add(rClass);
                }
            }

            this.Airline = airline;
            this.DataContext = this.Airline;
            this.Loaded += PageAirlineServices_Loaded;

            InitializeComponent();

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvFacilities.ItemsSource);
            view.GroupDescriptions.Clear();
            view.SortDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Type");
            view.GroupDescriptions.Add(groupDescription);

            SortDescription sortTypeDescription = new SortDescription("Type", ListSortDirection.Ascending);
            view.SortDescriptions.Add(sortTypeDescription);

            SortDescription sortFacilityDescription = new SortDescription("Facility.Name", ListSortDirection.Ascending);
            view.SortDescriptions.Add(sortFacilityDescription);

            for (int i = 120; i < 300; i += 15)
                cbCancellationPolicy.Items.Add(i);

            cbCancellationPolicy.SelectedItem = this.Airline.Airline.getAirlinePolicy("Cancellation Minutes").PolicyValue;
        }
        private void BindIgnoredApplications()
        {
            this.lstIgnoredApplications.ItemsSource = null;
            var lstApplications = ApplicationManager.Instance.GetIgnoredApplications().ToList();

            var sourceView = new ListCollectionView(lstApplications);//创建数据源的视图

            var groupDesctrption = new PropertyGroupDescription("MatchUsing");//设置分组列

            sourceView.GroupDescriptions.Add(groupDesctrption);//在图中添加分组
            this.lstIgnoredApplications.ItemsSource = sourceView;//绑定数据源
        }
        public SearchUsersViewModel(BusinessCoreService businessCoreService)
        {
            _contacts = new ObservableCollection<UserInfo>(businessCoreService.GetContacts().ToList());

            CvsStaff = new CollectionViewSource { Source = _contacts };
            GroupDescription gp = new PropertyGroupDescription("OrganizationId");
            SortDescription sp = new SortDescription("OrganizationId", ListSortDirection.Ascending);
            CvsStaff.GroupDescriptions.Add(gp);
            CvsStaff.SortDescriptions.Add(sp);
            CvsStaff.Filter += ApplyFilter;

            _businessCoreService = businessCoreService;
        }
        // public static event EventHandler StartCapture;
        public AvailableActions()
        {
            InitializeComponent();

            var actionsSourceView = new ListCollectionView(ActionInfos);//创建数据源的视图
            actionsSourceView.GroupDescriptions.Add(new PropertyGroupDescription("GestureName"));//在图中添加分组
            actionsSourceView.SortDescriptions.Add(new SortDescription("GestureName", ListSortDirection.Ascending));
            lstAvailableActions.ItemsSource = actionsSourceView;//绑定数据源

            var applicationSourceView = new ListCollectionView(_applications);
            var applicationGroupDesctrption = new PropertyGroupDescription("Group");//设置分组列
            applicationSourceView.GroupDescriptions.Add(applicationGroupDesctrption);//在图中添加分组
            lstAvailableApplication.ItemsSource = applicationSourceView;

            ActionDialog.ActionsChanged += (o, e) =>
            {
                if (lstAvailableApplication.SelectedItem == e.Application)
                {
                    var oldActionInfo =
                          ActionInfos.FirstOrDefault(ai => ai.ActionName.Equals(e.Action.Name, StringComparison.Ordinal));
                    if (oldActionInfo != null)
                    {
                        int index = ActionInfos.IndexOf(oldActionInfo);
                        var newActionInfo = Action2ActionInfo(e.Action);
                        ActionInfos[index] = newActionInfo;
                        RefreshGroup(e.Action.GestureName);
                        SelectAction(newActionInfo);
                    }
                    else RefreshActions(false);
                }
                else
                {
                    BindApplications();
                    _selecteNewestItem = true;
                    lstAvailableApplication.SelectedItem = e.Application;
                    lstAvailableApplication.ScrollIntoView(e.Application);
                }
            };
            AvailableGestures.GestureChanged += (o, e) => { RefreshActions(true); };
            GestureDefinition.GesturesChanged += (o, e) => { RefreshActions(true); };
            ApplicationDialog.UserApplicationChanged += (o, e) =>
            {
                BindApplications();
                lstAvailableApplication.SelectedItem = e.Application;
                lstAvailableApplication.ScrollIntoView(e.Application);
            };

            ApplicationManager.OnLoadApplicationsCompleted += (o, e) => { this.Dispatcher.InvokeAsync(BindApplications); };

            if (ApplicationManager.FinishedLoading) BindApplications();
        }
        //-------------------------------------------------------------------------------
        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();
        }
		private void SetGrouping()
		{
			_tracesView = CollectionViewSource.GetDefaultView(_traces);
			if (_groupsEnabled)
			{
				if (_traces.Any(t => !string.IsNullOrWhiteSpace(t.Indent)))
				{
					PropertyGroupDescription groupDescription = new PropertyGroupDescription("Indent");
					_tracesView.GroupDescriptions.Add(groupDescription);
				}
			}
			else
			{
				_tracesView.GroupDescriptions.Clear();
			}
		}
        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();
        }
        private void GroupByProperty(PropertyGroupDescription groupOption, GroupStyle grpStyle)
        {
            PersonCollection persons = (PersonCollection)FindResource("persons");
            ICollectionView view = CollectionViewSource.GetDefaultView(persons);

            if (view.GroupDescriptions.Count == 0)
            {
                view.GroupDescriptions.Add(groupOption);
                lbxPersons.GroupStyle.Add(grpStyle);
            }
            else
            {
                view.GroupDescriptions.Clear();
                lbxPersons.GroupStyle.Clear();
            }
        }
        public PerformanceOverviewView()
        {
            InitializeComponent();

            Loaded += (sender, args) =>
            {
                var viewModel = Locator.PerformanceOverviewViewModel;
                viewModel.DataAvailableEvent += (o, models) =>
                {
                    var performancesView = CollectionViewSource.GetDefaultView(models);
                    var locationGrouping = new PropertyGroupDescription("VenueViewModel.Location.Name");
                    var venueGrouping = new PropertyGroupDescription("VenueViewModel.VenueId");

                    performancesView.GroupDescriptions.Clear();
                    performancesView.GroupDescriptions.Add(locationGrouping);
                    performancesView.GroupDescriptions.Add(venueGrouping);
                };
            };
        }
        public PageAirlineInfo(AirlineMVVM airline)
        {
            this.Airline = airline;
            this.DataContext = this.Airline;
            this.AllAirports = new List<Airport>();

            InitializeComponent();

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvFleet.ItemsSource);
            view.GroupDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Purchased");
            view.GroupDescriptions.Add(groupDescription);

            logoPath = AppSettings.getDataPath() + "\\graphics\\airlinelogos\\default.png";
            imgLogo.Source = new BitmapImage(new Uri(logoPath, UriKind.RelativeOrAbsolute));

            foreach (Airport airport in this.Airline.Airline.Airports.FindAll(a => a.Terminals.getFreeSlotsPercent(this.Airline.Airline) > 50))
                this.AllAirports.Add(airport);
        }
        private void FirstTimeLoadedHandler(object sender, RoutedEventArgs e)
        {
            Loaded -= FirstTimeLoadedHandler;
            transcodeItemsCollectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(ViewModel.TranscodingManager.TranscodeItems);

            transcodeItemsCollectionView.IsLiveSorting = true;
            transcodeItemsCollectionView.LiveSortingProperties.Add(nameof(TranscodeItem.TranscodeStatus));
            var statusSortDescription = new SortDescription(nameof(TranscodeItem.TranscodeStatus), ListSortDirection.Ascending);
            transcodeItemsCollectionView.SortDescriptions.Add(statusSortDescription);

            transcodeItemsCollectionView.IsLiveGrouping = true;
            transcodeItemsCollectionView.LiveGroupingProperties.Add(nameof(TranscodeItem.TranscodeStatus));
            var statusGroupDescription = new PropertyGroupDescription(nameof(TranscodeItem.TranscodeStatus));
            transcodeItemsCollectionView.GroupDescriptions.Add(statusGroupDescription);

            foreach (var item in ViewModel.TranscodingManager.TranscodeItems)
            {
                PropertyChangedEventManager.AddHandler(item, TranscodeItemPropertyChanged, "");
            }
            CollectionChangedEventManager.AddHandler(ViewModel.TranscodingManager.TranscodeItems, TranscodeItemsCollectionChanged);
        }
        public MainWindow()
        {
            InitializeComponent();

            try
            {

                employees.Add(Initialize(new AnimationChannel() { Department = "Atmosphere", Name = "Fog Red Channel", Color = Colors.Red }, 0));
                employees.Add(Initialize(new AnimationChannel() { Department = "Atmosphere", Name = "Fog Blue Channel", Color = Colors.Blue }, 1));
                employees.Add(Initialize(new AnimationChannel() { Department = "Atmosphere", Name = "Fog Green Channel", Color = Colors.Green }, 2));

                CollectionView cv = (CollectionView)CollectionViewSource.GetDefaultView(employees);
                PropertyGroupDescription pgd = new PropertyGroupDescription("Department");
                cv.GroupDescriptions.Add(pgd);
                cv.Refresh();

                Part_AnimationEditor.ItemsSource = employees;

            }
            catch (Exception ex)
            {
            }
        }
        public PageAirportInfo(AirportMVVM airport)
        {
            this.Airport = airport;
            this.DataContext = this.Airport;

            InitializeComponent();

            CollectionView viewTerminals = (CollectionView)CollectionViewSource.GetDefaultView(lvTerminals.ItemsSource);
            viewTerminals.GroupDescriptions.Clear();

            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Type");
            viewTerminals.GroupDescriptions.Add(groupDescription);

            CollectionView viewDemands = (CollectionView)CollectionViewSource.GetDefaultView(lvDemand.ItemsSource);
            viewDemands.GroupDescriptions.Clear();

            viewDemands.GroupDescriptions.Add(new PropertyGroupDescription("Type"));

            SortDescription sortTypeDescription = new SortDescription("Type", ListSortDirection.Ascending);
            viewDemands.SortDescriptions.Add(sortTypeDescription);

            SortDescription sortPassengersDescription = new SortDescription("Passengers", ListSortDirection.Descending);
            viewDemands.SortDescriptions.Add(sortPassengersDescription);
        }
Exemple #23
0
        public QueryTool(User user, ToolsPlugin owner)
        {
            CommandBindings.Add(new CommandBinding(AddCriteria, ExecutedAddCriteria, CanExecuteAddCriteria));
            CommandBindings.Add(new CommandBinding(RemoveCriteria, ExecutedRemoveCriteria, CanExecuteRemoveCriteria));
            CommandBindings.Add(new CommandBinding(RemoveAllCriteria, ExecutedRemoveAllCriteria, CanExecuteRemoveAllCriteria));
            CommandBindings.Add(new CommandBinding(MoveCriteriaUp, ExecutedMoveCriteriaUp, CanExecuteMoveCriteriaUp));
            CommandBindings.Add(new CommandBinding(MoveCriteriaDown, ExecutedMoveCriteriaDown, CanExecuteMoveCriteriaDown));
            CommandBindings.Add(new CommandBinding(NewQuery, ExecutedNewQuery, CanExecuteNewQuery));
            CommandBindings.Add(new CommandBinding(OpenQuery, ExecutedOpenQuery, CanExecuteOpenQuery));
            CommandBindings.Add(new CommandBinding(SaveQuery, ExecutedSaveQuery, CanExecuteSaveQuery));
            CommandBindings.Add(new CommandBinding(ShowSQL, ExecutedShowSQL, CanExecuteShowSQL));
            CommandBindings.Add(new CommandBinding(ExecuteQuery, ExecutedExecuteQuery, CanExecuteExecuteQuery));

            ExecuteQuery.InputGestures.Add(new KeyGesture(Key.F5, ModifierKeys.Control));

            InitializeComponent();
            User = user;
            Owner = owner;

            var service = new SupportService(user);
            _fields = service.GetFieldMappings();
            lvwFields.ItemsSource = _fields;

            var myView = (CollectionView)CollectionViewSource.GetDefaultView(lvwFields.ItemsSource);
            var groupDescription = new PropertyGroupDescription("Category");
            if (myView.GroupDescriptions != null) {
                myView.GroupDescriptions.Add(groupDescription);
            }

            _model = new ObservableCollection<QueryCriteria>();
            criteriaGrid.ItemsSource = _model;

            var sortItems = new List<String>(new[] { CriteriaSortConverter.NOT_SORTED, "Ascending", "Descending" });
            sortColumn.ItemsSource = sortItems;
        }
        private void RefreshList()
        {
            if (null != mToken)
            {
                mToken.Cancel();
            }
            mToken = new CancellationTokenSource();
            string sSearch = textBox.Text;
            Task.Run(() =>
            {
                //Common.Instance.SolutionWatcher.SetNeedRefresh();
                IEnumerable<SearchResult<FileData>> results = null;
                if (string.IsNullOrWhiteSpace(sSearch))
                {
                    results = Common.Instance.SolutionWatcher.Files
                    .AsParallel()
                    .WithCancellation(mToken.Token)
                    .Where(fileData => fileData.Status == FileStatus.Recent)
                    .Select(fileData => new SearchResult<FileData>(fileData, sSearch, fileData.Path, "\\"))
                    .OrderByDescending(fileData => fileData.Data.RecentIndex) // Sort by last access
                    ;
                }
                else
                {
                    results = Common.Instance.SolutionWatcher.Files
                    .AsParallel()
                    .WithCancellation(mToken.Token)
                    .Select(fileData => new SearchResult<FileData>(fileData, sSearch, fileData.Path, "\\"))
                    .Where(fileData => fileData.SearchScore > 0)
                    .OrderByDescending(fileData => fileData.SearchScore) // Sort by score
                    .Take(250)
                    ;
                }

                if (!mToken.Token.IsCancellationRequested)
                {
                    Action<IEnumerable> setMethod = (res) =>
                    {
                        listView.ItemsSource = res;
                        CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listView.ItemsSource);
                        view.GroupDescriptions.Clear();

                        if (string.IsNullOrWhiteSpace(sSearch))
                        {
                            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Data.StatusString");
                            //groupDescription.GroupNames.Add(FileStatus.Recent.ToString());
                            /*foreach (string status in Enum.GetNames(typeof(FileStatus)))
                            {
                                groupDescription.GroupNames.Add(status);
                            }*/

                            view.GroupDescriptions.Add(groupDescription);
                        }
                    };
                    Dispatcher.BeginInvoke(setMethod, results);
                }
            });
        }
        public LineChartProperties(
            DashboardHelper dashboardHelper,
            IGadget gadget,
            LineChartParameters parameters,
            List<Grid> strataGridList
            )
        {
            InitializeComponent();
            this.DashboardHelper = dashboardHelper;
            this.Gadget = gadget;
            this.Parameters = parameters;
            this.StrataGridList = strataGridList;

            List<string> fields = new List<string>();
            List<string> weightFields = new List<string>();
            List<string> strataItems = new List<string>();

            //Variable fields
            fields.Add(String.Empty);
            ColumnDataType columnDataType = ColumnDataType.Boolean | ColumnDataType.DateTime | ColumnDataType.Numeric | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus")) fields.Add(fieldName);
                }
                else
                {
                    fields.Add(fieldName);
                }
            }
            cmbField.ItemsSource = fields;

            //Weight Fields
            weightFields.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus")) weightFields.Add(fieldName);
                }
                else
                {
                    weightFields.Add(fieldName);
                }
            }
            weightFields.Sort();
            cmbFieldWeight.ItemsSource = weightFields;
            cmbSecondYAxisVariable.ItemsSource = weightFields;

            //Strata Fields
            strataItems.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.Boolean | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus" || fieldName == "FKEY" || fieldName == "GlobalRecordId")) strataItems.Add(fieldName);
                }
                else
                {
                    strataItems.Add(fieldName);
                }
            }
            listboxFieldStrata.ItemsSource = strataItems;
            cmbFieldCrosstab.ItemsSource = strataItems;

            txtYAxisLabelValue.Text = "Count";
            txtXAxisLabelValue.Text = String.Empty;
            cmbLegendDock.SelectedIndex = 1;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(cmbField.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory");
            view.GroupDescriptions.Add(groupDescription);

            RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as LineChartGadget).DataFilters, true);
            RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelFilters.Children.Add(RowFilterControl);

            //EI-98
            txtXAxisFontSize.Text = parameters.XAxisFontSize.ToString();
            txtYAxisFontSize.Text = parameters.YAxisFontSize.ToString();

            txtXAxisLabelFontSize.Text = parameters.XAxisLabelFontSize.ToString();
            txtYAxisLabelFontSize.Text = parameters.YAxisLabelFontSize.ToString();

            txtWidth.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);
            txtHeight.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);
            txtLegendFontSize.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);

            #region Translation

            #endregion // Translation
        }
Exemple #26
0
        /// <summary>
        /// Helper method which determines if one can create a SortDescription out of
        /// a GroupDescription.
        /// </summary>
        /// <param name="propertyGroupDescription"></param>
        /// <returns></returns>
        private static bool CanConvertToSortDescription(PropertyGroupDescription propertyGroupDescription)
        {
            if (propertyGroupDescription != null &&
                propertyGroupDescription.Converter == null &&
                propertyGroupDescription.StringComparison == StringComparison.Ordinal)
            {
                return true;
            }

            return false;
        }
        public LineListProperties(
            DashboardHelper dashboardHelper, 
            IGadget gadget, 
            LineListParameters parameters, 
            List<Grid> strataGridList,
            List<string> columnOrder
            )
        {
            InitializeComponent();
            this.DashboardHelper = dashboardHelper;
            this.Gadget = gadget;
            this.Parameters = parameters;
            this.StrataGridList = strataGridList;
            this.ColumnOrder = columnOrder;

            List<FieldInfo> items = new List<FieldInfo>();
            List<string> fields = new List<string>();

            foreach (string fieldName in DashboardHelper.GetFieldsAsList())
            {
                items.Add(new FieldInfo()
                {
                    Name = fieldName,
                    DataType = DashboardHelper.GetColumnDbType(fieldName).ToString(),
                    VariableCategory = VariableCategory.Field
                });

                fields.Add(fieldName);
            }

            foreach (string fieldName in DashboardHelper.GetAllGroupsAsList())
            {
                FieldInfo fieldInfo = new FieldInfo()
                {
                    Name = fieldName,
                    DataType = String.Empty,
                    VariableCategory = VariableCategory.Group
                };
                items.Add(fieldInfo);
            }

            if (DashboardHelper.IsUsingEpiProject)
            {
                for (int i = 0; i < DashboardHelper.View.Pages.Count; i++)
                {
                    items.Add(new FieldInfo()
                    {
                        Name = "Page " + (i + 1).ToString(),
                        DataType = String.Empty,
                        VariableCategory = VariableCategory.Page
                    });
                }
            }

            fields.Sort();

            lvVariables.ItemsSource = items;
            cmbGroupField.ItemsSource = fields;
            cmbSecondaryGroupField.ItemsSource = fields;

            foreach (string fieldName in fields)
            {
                lbxAvailableVariables.Items.Add(fieldName);
            }

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvVariables.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory");
            view.GroupDescriptions.Add(groupDescription);

            RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as LineListControl).DataFilters, true);
            RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelFilters.Children.Add(RowFilterControl);
        }
        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 FrequencyProperties(
            DashboardHelper dashboardHelper,
            IGadget gadget,
            FrequencyParameters parameters,
            List<Grid> strataGridList
            )
        {
            InitializeComponent();
            this.DashboardHelper = dashboardHelper;
            this.Gadget = gadget;
            this.Parameters = parameters;
            this.StrataGridList = strataGridList;

            List<string> fields = new List<string>();
            List<string> weightFields = new List<string>();
            List<string> strataItems = new List<string>();

            //Variable fields
            fields.Add(String.Empty);
            ColumnDataType columnDataType = ColumnDataType.Boolean | ColumnDataType.DateTime | ColumnDataType.Numeric | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus")) fields.Add(fieldName);
                }
                else
                {
                    fields.Add(fieldName);
                }
            }
            cbxField.ItemsSource = fields;
            lbxField.ItemsSource = fields;
            //Weight Fields
            weightFields.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus")) weightFields.Add(fieldName);
                }
                else
                {
                    weightFields.Add(fieldName);
                }
            }
            weightFields.Sort();
            cbxFieldWeight.ItemsSource = weightFields;

            //Strata Fields
            strataItems.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.Boolean | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus" || fieldName == "FKEY" || fieldName == "GlobalRecordId")) strataItems.Add(fieldName);
                }
                else
                {
                    strataItems.Add(fieldName);
                }
            }
            lbxFieldStrata.ItemsSource = strataItems;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(cbxField.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory");
            view.GroupDescriptions.Add(groupDescription);

            RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as FrequencyControl).DataFilters, true);
            RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelFilters.Children.Add(RowFilterControl);

            txtRows.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);
            txtBarWidth.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);

            #region Translation

            lblConfigExpandedTitle.Content = DashboardSharedStrings.GADGET_CONFIG_TITLE_FREQUENCY;
            //expanderAdvancedOptions.Header = DashboardSharedStrings.GADGET_ADVANCED_OPTIONS;
            //expanderDisplayOptions.Header = DashboardSharedStrings.GADGET_DISPLAY_OPTIONS;
            tblockMainVariable.Text = DashboardSharedStrings.GADGET_FREQUENCY_VARIABLE;
            tblockStrataVariable.Text = DashboardSharedStrings.GADGET_STRATA_VARIABLE;
            tblockWeightVariable.Text = DashboardSharedStrings.GADGET_WEIGHT_VARIABLE;

            //checkboxAllValues.Content = DashboardSharedStrings.GADGET_ALL_LIST_VALUES;
            //checkboxCommentLegalLabels.Content = DashboardSharedStrings.GADGET_LIST_LABELS;
            checkboxIncludeMissing.Content = DashboardSharedStrings.GADGET_INCLUDE_MISSING;

            checkboxSortHighLow.Content = DashboardSharedStrings.GADGET_SORT_HI_LOW;
            checkboxUsePrompts.Content = DashboardSharedStrings.GADGET_USE_FIELD_PROMPT;
            //tblockOutputColumns.Text = DashboardSharedStrings.GADGET_OUTPUT_COLUMNS_DISPLAY;
            //tblockPrecision.Text = DashboardSharedStrings.GADGET_DECIMALS_TO_DISPLAY;

            tblockRows.Text = DashboardSharedStrings.GADGET_MAX_ROWS_TO_DISPLAY;
            tblockBarWidth.Text = DashboardSharedStrings.GADGET_MAX_PERCENT_BAR_WIDTH;

            //btnRun.Content = DashboardSharedStrings.GADGET_RUN_BUTTON;
            #endregion // Translation
        }
        /// <summary>
        /// Refresh subscription list when changed is made
        /// </summary>
        public void refreshSubscriptionList()
        {
            // Bind subscription list with ListView
            this.subscriptionList.ItemsSource = CategoryManager.getInstance().GetAllSubscription();

            // Indicate which properties is the group
            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(this.subscriptionList.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Manager.Parent.Name");
            view.GroupDescriptions.Add(groupDescription);
        }