private void UpdateFromCache(ICommandBarService commandBarService, Func<string, bool> f)
        {
            var toAdd = this.cache.Where(c => f(c.CommandInfo.BarName)).ToList();

            toAdd.ForEach(i =>
            {
                commandBarService.AddCommand(i.CommandInfo, i.Command);
                this.cache.Remove(i);
            });
        }
        private void UpdateFromCache(ICommandBarService commandBarService, Func <string, bool> f)
        {
            var toAdd = this.cache.Where(c => f(c.CommandInfo.BarName)).ToList();

            toAdd.ForEach(i =>
            {
                commandBarService.AddCommand(i.CommandInfo, i.Command);
                this.cache.Remove(i);
            });
        }
Example #3
0
        public async void Initialize()
        {
            Func <SampleViewActivityInfo> f = () => new SampleViewActivityInfo("Sample View" + (viewIndex != 0 ? " (" + viewIndex++ + ")" : ""), isCloseable: true)
            {
                MessageFormat = "Hello {0}"
            };

            await activityService.StartActivityAsync(f());

            commandBarService.AddCommand(new CommandInfo("New Sample View"), new StartActivityCommand <SampleViewActivityInfo>(activityService, f));
        }
 public void AddCommand(CommandInfo commandInfo, ICommand command)
 {
     if (!string.IsNullOrEmpty(commandInfo.BarName) && commandBarServices.ContainsKey(commandInfo.BarName))
     {
         commandBarServices[commandInfo.BarName].AddCommand(commandInfo, command);
     }
     else if (string.IsNullOrEmpty(commandInfo.BarName) && defaultCommandBarService != null)
     {
         defaultCommandBarService.AddCommand(commandInfo, command);
     }
     else
     {
         cache.Add(new CommandObject {
             CommandInfo = commandInfo, Command = command
         });
     }
 }