public RenameProgramItemCommand(ProgramItem programItem, string newName)
        {
            this.ProgramItem = programItem;

            this.OldName = programItem.Name;
            this.NewName = newName;

            this.Name = "Rename '" + programItem.Name;
        }
Esempio n. 2
0
        public RenameProgramItemCommand(ProgramItem programItem, string newName)
        {
            this.ProgramItem = programItem;

            this.OldName = programItem.Name;
            this.NewName = newName;

            this.Name = "Rename '" + programItem.Name;
        }
Esempio n. 3
0
        public MoveProgramItemCommand(ProgramItem programItem, ProgramCategory newCategory, string matchedSelector)
        {
            this.ProgramItem = programItem;

            this.OldCategory = programItem.Category;
            this.NewCategory = newCategory;
            this.Name        = string.Format("Move '{0}' to '{1}' because of '{2}'", Path.GetFileName(programItem.Name), newCategory.Name, matchedSelector);

            oldPaths = new List <string>(ProgramItem.Locations);
        }
        public MoveProgramItemCommand(ProgramItem programItem, ProgramCategory newCategory, string matchedSelector)
        {
            this.ProgramItem = programItem;

            this.OldCategory = programItem.Category;
            this.NewCategory = newCategory;
            this.Name = string.Format("Move '{0}' to '{1}' because of '{2}'", Path.GetFileName(programItem.Name), newCategory.Name, matchedSelector);

            oldPaths = new List<string>(ProgramItem.Locations);
        }
Esempio n. 5
0
        public void ProgramItemEquality()
        {
            Directory.CreateDirectory("Empty");
            StartMenu       s   = new StartMenu("Empty");
            ProgramCategory cat = new ProgramCategory(s);
            ProgramItem     a   = new ProgramItem(cat, "Hello.lnk");
            ProgramItem     b   = new ProgramItem(cat, "Hello.lnk");

            Assert.IsTrue(a == b, "Equality operator failed");
            Assert.AreEqual(true, a.Equals(b), "Explicit call to IEquatable<T> method failed");
            Assert.AreEqual(a, b, "Generic Assert.AreEqual call failed");
        }
Esempio n. 6
0
        public void RemapButton(uint button)
        {
            if (false == Items.ContainsKey(button))
            {
                return;
            }

            var item = Items[button];

            if (item.Locked)
            {
                return;
            }

            var availableItems = Items.Values.Where(x => x.Locked == false);

            uint        currentJoyId = ScController.vJoyMapper.vJoyMap[item.ControllerType];
            uint        selectedId   = uint.MaxValue;
            ProgramItem selectedItem = null;

            foreach (var available in availableItems)
            {
                uint availableId = ScController.vJoyMapper.vJoyMap[available.ControllerType];
                if (availableId > currentJoyId && availableId < selectedId)
                {
                    selectedId   = availableId;
                    selectedItem = available;
                }
            }

            if (selectedItem == null)
            {
                selectedId = uint.MaxValue;
                foreach (var available in availableItems)
                {
                    uint availableId = ScController.vJoyMapper.vJoyMap[available.ControllerType];
                    if (availableId < selectedId)
                    {
                        selectedId   = availableId;
                        selectedItem = available;
                    }
                }
            }

            if (selectedItem != null)
            {
                log.Debug($"Swapping {item.ControllerType} with {selectedItem.ControllerType}");
                ScController.vJoyMapper.vJoyMap[item.ControllerType]         = ScController.vJoyMapper.vJoyMap[selectedItem.ControllerType];
                ScController.vJoyMapper.vJoyMap[selectedItem.ControllerType] = currentJoyId;
            }
        }
 public static ProgramItemViewModel ToViewModel(this ProgramItem item)
 {
     if (item == null)
     {
         return(ProgramItemViewModel.Empty);
     }
     return(new ProgramItemViewModel()
     {
         Id = item.Id,
         Name = item.Name,
         Description = item.Description,
         ProjectId = item.ProjectId,
         Users = item.Authors,
     });
 }
Esempio n. 8
0
 public string FindCategory(ProgramItem item, bool processRestricted, out string matchedSelector)
 {
     foreach (var category in this)
     {
         if (!processRestricted && category.IsRestricted)
         {
             continue;
         }
         foreach (var catItem in category.Where(catItem => catItem.RegexObject.IsMatch(item.Name)))
         {
             matchedSelector = catItem.Value;
             return(category.Name);
         }
     }
     matchedSelector = null;
     return(null);
 }
Esempio n. 9
0
        private void EditProperties(object sender, MouseButtonEventArgs e)
        {
            if (EditProgramItemGrid.Children.Count == 0)
            {
                EditableProgramItemControl epic = new EditableProgramItemControl((ProgramItemBase)ProgramItem.Clone());

                epic.Cancel += CancelEdit;
                epic.Save   += SaveProgramItem;

                EditProgramItemGrid.Children.Add(epic);
            }

            EditProgramItemGrid.Visibility = Visibility.Visible;

            DoubleAnimation fade = new DoubleAnimation(0.0, 1.0, TimeSpan.FromMilliseconds(fadeTime));

            fade.Completed += (send, args) => { DisplayProgramItemGrid.Visibility = Visibility.Hidden; };

            EditProgramItemGrid.ApplyAnimationClock(OpacityProperty, fade.CreateClock());
        }
Esempio n. 10
0
 private void LaunchProgram(object sender, MouseButtonEventArgs e)
 {
     ProgramItem.LaunchProgram(sender, e);
 }
 public ConvertToCategoryCommand(ProgramItem programItem, ICollection<string> knownCategories)
 {
     this.programItem = programItem;
     this.KnownCategories = knownCategories;
     this.Name = string.Format("Make {0} a category", Path.GetFileNameWithoutExtension(programItem.Name));
 }
 public DeleteProgramItemCommand(ProgramItem programItem)
 {
     this.programItem = programItem;
     this.programItemName = programItem.Name;
     this.Name = "Delete '" + programItem.Name + "'";
 }
Esempio n. 13
0
 public DeleteProgramItemCommand(ProgramItem programItem)
 {
     this.programItem     = programItem;
     this.programItemName = programItem.Name;
     this.Name            = "Delete '" + programItem.Name + "'";
 }
Esempio n. 14
0
        public void ProgramItemEquality()
        {
            Directory.CreateDirectory("Empty");
            StartMenu s = new StartMenu("Empty");
            ProgramCategory cat = new ProgramCategory(s);
            ProgramItem a = new ProgramItem(cat, "Hello.lnk");
            ProgramItem b = new ProgramItem(cat, "Hello.lnk");

            Assert.IsTrue(a == b, "Equality operator failed");
            Assert.AreEqual(true, a.Equals(b), "Explicit call to IEquatable<T> method failed");
            Assert.AreEqual(a, b, "Generic Assert.AreEqual call failed");
        }
 public ConvertToCategoryCommand(ProgramItem programItem, ICollection <string> knownCategories)
 {
     this.programItem     = programItem;
     this.KnownCategories = knownCategories;
     this.Name            = string.Format("Make {0} a category", Path.GetFileNameWithoutExtension(programItem.Name));
 }