Ejemplo n.º 1
0
        /// <summary>
        /// Устанавливает свойства модели, которые не могут быть установлены автоматически
        /// </summary>
        public override void DoCustomBinding()
        {
            base.DoCustomBinding();

            SelectedGroups = SelectedGroups?.Where(n => n != null).ToArray() ?? new QPCheckedItem[] { };
            Data.Groups    = SelectedGroups.Any() ? Service.GetUserGroups(Converter.ToInt32Collection(SelectedGroups.Select(g => g.Value).ToArray())) : Enumerable.Empty <BLL.UserGroup>();
        }
Ejemplo n.º 2
0
        public void SelectGroup(UnitListObject parent)
        {
            ClearRename();
            if (Input.GetKey(KeyCode.LeftShift))
            {
                AddToGrpSelection(parent);
            }
            else if (Input.GetKey(KeyCode.LeftControl))
            {
                if (SelectedGroups.Contains(parent))
                {
                    RemoveFromGrpSelection(parent);
                }
                else
                {
                    AddToGrpSelection(parent);
                }
            }
            else
            {
                ClearGrpSelection();
                AddToGrpSelection(parent);
            }

            UpdateGroupSelection();
        }
Ejemplo n.º 3
0
 public void UpdateGroupSelection()
 {
     foreach (UnitListObject ulo in UnitGroups)
     {
         ulo.UpdateSelection(SelectedGroups.Contains(ulo), ulo == FirstSelected);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds group to the seleted groups
 /// </summary>
 /// <param name="group">Group to add</param>
 private void AddGroupToList(Group group)
 {
     if (AllowMultiSelect && !this.SelectedGroups.Select(g => g.Id).Contains(group.Id))
     {
         var selectedGroups = SelectedGroups.ToList();
         selectedGroups.Add(group);
         this.SelectedGroups = selectedGroups;
     }
 }
Ejemplo n.º 5
0
        public override bool CheckSettings()
        {
            if (CreateReport)
            {
                if (ExportToAnotherWbk)
                {
                    if (string.IsNullOrWhiteSpace(XlsPath) ||
                        !Directory.Exists(System.IO.Path.GetDirectoryName(XlsPath)) ||
                        System.IO.Path.GetExtension(XlsPath) != GlobalDefines.XLSX_EXTENSION)
                    {
                        MessageBox.Show(m_ParentWnd,
                                        Properties.Resources.resInvalidXlsxPath,
                                        (Parent as TabItem).Header.ToString(),
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                        return(false);
                    }

                    if (File.Exists(XlsPath))
                    {   // Перезаписывать файлы нельзя
                        MessageBox.Show(m_ParentWnd,
                                        Properties.Resources.resXlsxFileAlreadyExists,
                                        (Parent as TabItem).Header.ToString(),
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                        return(false);
                    }
                }

                if (SelectedGroups.Count == 0)
                {       // Ничего не выделено
                    MessageBox.Show(m_ParentWnd,
                                    Properties.Resources.resNoGroupsToExport,
                                    (Parent as TabItem).Header.ToString(),
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    return(false);
                }

                if (SelectedGroups.Where(arg => arg.StartYearIndToExport > arg.EndYearIndToExport && arg.CanSelectYears).Count() > 0)
                {       // Есть ошибки в задании годов
                    MessageBox.Show(m_ParentWnd,
                                    Properties.Resources.resInvalidYearsToExport,
                                    (Parent as TabItem).Header.ToString(),
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 6
0
        public void SelectGroup(UnitListObject parent, bool onTitle)
        {
            ClearRename();
            if (Input.GetKey(KeyCode.LeftShift))
            {
                AddToGrpSelection(parent);
            }
            else if (Input.GetKey(KeyCode.LeftControl))
            {
                if (SelectedGroups.Contains(parent))
                {
                    RemoveFromGrpSelection(parent);
                }
                else
                {
                    AddToGrpSelection(parent);
                }
            }
            else
            {
                if (SelectedGroups.Count == 1 && SelectedGroups[0] == parent)
                {
                    if (!onTitle && Time.realtimeSinceStartup - LastClickTime < UnitListObject.DoubleClickTime)
                    {
                        SelectionManager.Current.CleanSelection();

                        List <UnitInstance> SelectedInstances = new List <UnitInstance>(128);

                        parent.Source.GetAllUnitInstances(ref SelectedInstances);

                        GameObject[] NewSelection = new GameObject[SelectedInstances.Count];

                        for (int i = 0; i < SelectedInstances.Count; i++)
                        {
                            NewSelection[i] = SelectedInstances[i].gameObject;
                        }

                        SelectionManager.Current.SelectObjects(NewSelection);
                    }
                }
                else
                {
                    ClearGrpSelection();
                    AddToGrpSelection(parent);
                }

                LastClickTime = Time.realtimeSinceStartup;
            }

            UpdateGroupSelection();
        }
Ejemplo n.º 7
0
 public ExportViewModel(IExportService exporter)
 {
     GroupSelectionChangedCommand = new RelayCommand <IEnumerable <object> >(SetListSelection);
     ExportCommand =
         new RelayCommand <Guid>(guid => _exporter.ExportAsync(SelectedGroups.ToList(), _settings, guid));
     _exporter = exporter;
     _plugins  = new ObservableCollection <IFileExporter>(_exporter.GetPlugins());
     MessengerInstance.Register <string>(this, msg =>
     {
         if (msg == Ri2Constants.Notifications.GroupsUpdated)
         {
             RaisePropertyChanged(nameof(Groups));
         }
     });
 }
Ejemplo n.º 8
0
 public Boolean MatchesFilter(TranslationItemViewModel translationLine)
 {
     if (translationLine == null)
     {
         return(false);
     }
     return((!TranslatedFilter.HasValue || translationLine.IsTranslated == TranslatedFilter.Value) &&
            (!EditingFilter.HasValue || translationLine.HasChangesInEditor == EditingFilter.Value) &&
            (String.IsNullOrWhiteSpace(AddressFilter) || translationLine.Address.StartsWith(AddressFilter, StringComparison.InvariantCultureIgnoreCase)) &&
            (SelectedGroups.Count == 0 || (InverseGroupFilter && !SelectedGroups.Contains(translationLine.Group)) || (!InverseGroupFilter && SelectedGroups.Contains(translationLine.Group))) &&
            MatchesContentFilter(translationLine) &&
            (!PotentialOverflowFilter || translationLine.TranslatedLineLength > 320 && translationLine.LineLengthDifference > 0) &&
            (!PotentialRepointIssueFilter || translationLine.RemainingLength < 0 && translationLine.PointerText.References.Where(r => r.Repoint).Count() != 1)
            );
 }
Ejemplo n.º 9
0
        protected void RepGroups_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            DataRow row = SelectedGroups.NewRow();

            row["Name"] = ((Label)RepGroups.Items[e.Item.ItemIndex].FindControl("ltrlGroupNM")).Text;
            row["Id"]   = ((HiddenField)RepGroups.Items[e.Item.ItemIndex].FindControl("hfGroupId")).Value;
            this.SelectedGroups.Rows.Add(row);

            ((LinkButton)this.RepGroups.Items[e.Item.ItemIndex].FindControl("selectbtn")).Enabled = false;

            this.RepSelected.DataSource = this.SelectedGroups;
            this.RepSelected.DataBind();

            manager = new DataManager();
            this.RepGroups.DataSource = manager.GetGroups(string.Empty);
            this.RepGroups.DataBind();
        }
Ejemplo n.º 10
0
 static IEnumerable <SelectionResult <T> > Select211FromGroups <T>(SelectedGroups <T> groups)
 {
     for (var i = 0; i < groups.Choose2.Count - 1; i++)
     {
         var value11 = groups.Choose2[i];
         // start from i+1 so  j > i so groups.Choose2[i] and groups.Choose2[j] cover all the pairs excactly once
         for (var j = i + 1; j < groups.Choose2.Count; j++)
         {
             var value12 = groups.Choose2[j];
             foreach (var value3 in groups.Choose1_1)
             {
                 foreach (var value4 in groups.Choose1_2)
                 {
                     yield return(new SelectionResult <T>(value11, value12, value3, value4));
                 }
             }
         }
     }
 }
Ejemplo n.º 11
0
        public void Clear()
        {
            ClearRename();

            if (UnitGroups == null)
            {
                UnitGroups = new HashSet <UnitListObject>();
            }
            else
            {
                foreach (UnitListObject ulo in UnitGroups)
                {
                    if (ulo != null)
                    {
                        Destroy(ulo.gameObject);
                    }
                }

                UnitGroups.Clear();
            }

            SelectedGroups.Clear();
        }
Ejemplo n.º 12
0
        private void ClearFilter()
        {
            _translatedFilter = null;
            _unsavedFilter    = null;
            SelectedGroups.Clear();
            _addressFilter               = null;
            _contentFilter               = null;
            _currentContainsMode         = ContainsModes[0];
            _inverseGroupFilter          = false;
            _potentialOverflowFilter     = false;
            _potentialRepointIssueFilter = false;

            OnPropertyChanged("TranslatedFilter");
            OnPropertyChanged("EditingFilter");
            OnPropertyChanged("AddressFilter");
            OnPropertyChanged("ContentFilter");
            OnPropertyChanged("CurrentContainsMode");
            OnPropertyChanged("InverseGroupFilter");
            OnPropertyChanged("PotentialOverflowFilter");
            OnPropertyChanged("PotentialRepointIssueFilter");

            OnFilterChanged();
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Устанавливает свойства модели, которые не могут быть установлены автоматически
 /// </summary>
 internal override void DoCustomBinding()
 {
     Data.DoCustomBinding();
     Data.Groups = SelectedGroups.Any() ? Service.GetUserGroups(Converter.ToInt32Collection(SelectedGroups.Select(g => g.Value).ToArray())) : Enumerable.Empty <BLL.UserGroup>();
 }