示例#1
0
 /// <summary>
 /// On activation, invokes all setter properties with the current recipe argument value.
 /// <seealso cref="Microsoft.WizardFramework.WizardPage.OnActivate"/>
 /// </summary>
 /// <returns></returns>
 public override bool OnActivate()
 {
     if (base.OnActivate())
     {
         IDictionaryService dictionaryService =
             (IDictionaryService)GetService(typeof(IDictionaryService));
         foreach (DictionaryEntry entry in Arguments)
         {
             ValueInfo    argument = (ValueInfo)entry.Key;
             PropertyInfo property = (PropertyInfo)entry.Value;
             try
             {
                 property.SetValue(this, dictionaryService.GetValue(argument.Name), null);
                 this.Wizard.OnValidationStateChanged(this);
             }
             catch (Exception ex)
             {
                 throw new InvalidOperationException(
                           String.Format(CultureInfo.CurrentCulture,
                                         Properties.Resources.WizardGatheringService_CannotSetProperty,
                                         property.Name,
                                         GetType().Name), ex);
             }
         }
         IComponentChangeService componentChange =
             (IComponentChangeService)GetService(typeof(IComponentChangeService));
         if (componentChange != null)
         {
             componentChange.ComponentChanged += new ComponentChangedEventHandler(RecipeArgumentChanged);
         }
         return(true);
     }
     return(false);
 }
示例#2
0
        private void cmdDesignerPropertyDel_Click(object sender, System.EventArgs e)
        {
            try
            {
                ResetAllErrProviders();
                if (lstDesignerProperties.SelectedItem == null)
                {
                    ErrProv.SetError(cmdDesignerPropertyDel,
                                     "Please select a value in the property list");
                    return;
                }

                Object objItem     = lstDesignerProperties.SelectedItem;
                string strVal      = objItem.ToString();
                string strPropName = strVal.Substring(0, strVal.IndexOf("(") - 1);
                lstDesignerProperties.Items.Remove(lstDesignerProperties.SelectedItem);

                // Also remove item from the wizard
                IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;
                designPropertyList.Remove(new DesignPropertyItem(txtDesignerProperty.Text, cmbDesignerPropertyDataType.Text));
                dictionaryService.SetValue("DesignPropertyList", designPropertyList);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                Trace.WriteLine(err.Message + Environment.NewLine + err.StackTrace);
            }
        }
示例#3
0
        private void cmdDesignerPropertyAdd_Click(object sender, System.EventArgs e)
        {
            try
            {
                ResetAllErrProviders();
                if (!Regex.IsMatch(txtDesignerProperty.Text, @"^[_a-zA-Z][_a-zA-Z0-9]*$"))
                {
                    ErrProv.SetError(txtDesignerProperty,
                                     "Please enter a valid name for the new property");
                    return;
                }
                if (VarNameAlreadyExists(txtDesignerProperty.Text))
                {
                    ErrProv.SetError(txtDesignerProperty,
                                     "Please enter a unique name. No two properties can have the same name");
                    return;
                }
                lstDesignerProperties.Items.Add(txtDesignerProperty.Text + " (" + cmbDesignerPropertyDataType.Text + ")");

                // Also add item to the wizard
                IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;
                designPropertyList.Add(new DesignPropertyItem(txtDesignerProperty.Text, cmbDesignerPropertyDataType.Text));
                dictionaryService.SetValue("DesignPropertyList", designPropertyList);

                txtDesignerProperty.Clear();
                cmbDesignerPropertyDataType.Text = "string";
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                Trace.WriteLine(err.Message + Environment.NewLine + err.StackTrace);
            }
        }
示例#4
0
        /// <summary>
        /// <see cref="ISupportInitialize.EndInit"/>
        /// </summary>
        public override void EndInit()
        {
            base.EndInit();
            //If we are still initializing , then do nothing
            if (IsInitializing)
            {
                return;
            }
            //OK: The base class is now initialized
            this.checkBox.Text = this.FieldConfig.Label;
            this.ToolTip.SetToolTip(checkBox, this.FieldConfig.Tooltip);

            IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;

            if (dictionaryService != null)
            {
                object val = dictionaryService.GetValue(this.FieldConfig.ValueName);
                if (val == null)
                {
                    SetValue(false);
                }
            }
            if (this.FieldConfig.ReadOnly)
            {
                this.checkBox.Enabled = false;
            }
        }
示例#5
0
        // On designer initialization, this method attempts to obtain
        // the IDictionaryService, and populates an ArrayList
        // associated with a "DesignerData" key in the dictionary with
        // designer- and control-related information strings.
        public override void Initialize(System.ComponentModel.IComponent component)
        {
            base.Initialize(component);
            IDictionaryService ds = (IDictionaryService)component.Site.GetService(typeof(IDictionaryService));

            if (ds != null)
            {
                // If the dictionary service does not contain a
                // DesignerData key, adds an ArrayList for that key.
                if (ds.GetValue("DesignerData") == null)
                {
                    ds.SetValue("DesignerData", new ArrayList());
                    ds.SetValue("DesignerData", new ArrayList());
                }

                // Obtains the ArrayList with the "DesignerData" key
                // from the dictionary service.
                ArrayList al = (ArrayList)ds.GetValue("DesignerData");
                if (al != null)
                {
                    al.Clear();
                    // Populates the array list with designer and
                    // control information strings.
                    al.Add("Designer type: " + this.GetType().Name);
                    al.Add("Control type:  " + this.Control.GetType().Name);
                    al.Add("Control name:  " + this.Control.Name);
                }
            }
        }
示例#6
0
        public MainWindow(
            IAudioService audioService,
            IDictionaryService dictionaryService,
            IInputService inputService)
        {
            InitializeComponent();

            this.audioService      = audioService;
            this.dictionaryService = dictionaryService;
            this.inputService      = inputService;

            managementWindowRequest = new InteractionRequest <NotificationWithServices>();

            //Setup key binding (Alt-C and Shift-Alt-C) to open settings
            InputBindings.Add(new KeyBinding
            {
                Command   = new DelegateCommand(RequestManagementWindow),
                Modifiers = ModifierKeys.Alt,
                Key       = Key.M
            });
            InputBindings.Add(new KeyBinding
            {
                Command   = new DelegateCommand(RequestManagementWindow),
                Modifiers = ModifierKeys.Shift | ModifierKeys.Alt,
                Key       = Key.M
            });

            Title = string.Format("OptiKey v{0}", DiagnosticInfo.AssemblyVersion);
        }
 /// <summary>Provides the name of an item been unfolded</summary>
 /// <param name="currentValue"></param>
 /// <param name="newValue"></param>
 /// <returns></returns>
 /// <seealso cref="ValueProvider.OnBeginRecipe"/>
 public override bool OnBeginRecipe(object currentValue, out object newValue)
 {
     if (currentValue == null)
     {
         IDictionaryService dictionaryService = (IDictionaryService)GetService(typeof(IDictionaryService));
         string             name = dictionaryService.GetValue("rootname") as string;
         if (name != null)
         {
             name = Path.GetFileNameWithoutExtension(name);
         }
         else
         {
             name = dictionaryService.GetValue("projectname") as string;
         }
         if (name != null)
         {
             newValue = name;
             return(true);
         }
         else
         {
             newValue = currentValue;
             return(false);
         }
     }
     newValue = currentValue;
     return(false);
 }
        public override bool OnBeginRecipe(object currentValue, out object newValue)
        {
            if (currentValue != null)
            {
                // Do not assign a new value, and return false to flag that
                // we don't want the current value to be changed.
                newValue = null;
                return(false);
            }

            IDictionaryService dictionaryService = (IDictionaryService)this.GetService(typeof(IDictionaryService));

            try
            {
                string solutionName = dictionaryService.GetValue("SolutionName").ToString();
                solutionName = Regex.Replace(solutionName, @"[^\w\.@-]", string.Empty);
                //solutionName.Replace(" ", "_");
                newValue = solutionName;
                return(true);
            }
            catch (Exception)
            {
            }

            newValue = "Defaultname";
            return(true);
        }
示例#9
0
        object[] IReferenceService.GetReferences(Type baseType)
        {
            IConfigurationService configService =
                (IConfigurationService)GetService(typeof(IConfigurationService));

            if (configService == null || configService.CurrentRecipe == null)
            {
                return(new object[] { });
            }
            Configuration.Argument[] arguments         = configService.CurrentRecipe.Arguments;
            IDictionaryService       dictionaryService =
                (IDictionaryService)GetService(typeof(IDictionaryService));

            if (dictionaryService == null || arguments == null)
            {
                return(new object[] { });
            }
            ArrayList references = new ArrayList();

            foreach (Configuration.Argument arg in arguments)
            {
                object value = dictionaryService.GetValue(arg.Name);
                if (value != null)
                {
                    if (baseType == null || (baseType.IsAssignableFrom(value.GetType())))
                    {
                        references.Add(value);
                    }
                }
            }
            return(references.ToArray());
        }
示例#10
0
        /// <summary>
        ///     This adds the delegate value as a listener to when this event is fired
        ///     by the component, invoking the addOnXXX method.
        /// </summary>
        public override void AddEventHandler(object component, Delegate value)
        {
            FillMethods();

            if (component != null)
            {
                ISite site = GetSite(component);
                IComponentChangeService changeService = null;

                // Announce that we are about to change this component
                //
                if (site != null)
                {
                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                }

                if (changeService != null)
                {
                    try {
                        changeService.OnComponentChanging(component, this);
                    }
                    catch (CheckoutException coEx) {
                        if (coEx == CheckoutException.Canceled)
                        {
                            return;
                        }
                        throw coEx;
                    }
                    changeService.OnComponentChanging(component, this);
                }

                bool shadowed = false;

                if (site != null && site.DesignMode)
                {
                    // Events are final, so just check the class
                    if (EventType != value.GetType())
                    {
                        throw new ArgumentException(SR.Format(SR.ErrorInvalidEventHandler, Name));
                    }
                    IDictionaryService dict = (IDictionaryService)site.GetService(typeof(IDictionaryService));
                    if (dict != null)
                    {
                        Delegate eventdesc = (Delegate)dict.GetValue(this);
                        eventdesc = Delegate.Combine(eventdesc, value);
                        dict.SetValue(this, eventdesc);
                        shadowed = true;
                    }
                }

                if (!shadowed)
                {
                    _addMethod.Invoke(component, new[] { value });
                }

                // Now notify the change service that the change was successful.
                //
                changeService?.OnComponentChanged(component, this, null, value);
            }
        }
示例#11
0
        public MainViewModel(INavigationService navigationService,
                             IApiService apiService,
                             IDictionaryService dictionaryService,
                             ILocalStorageService localStorageService,
                             IRoamingStorageService roamingStorageService,
                             IAnalyticsService analyticsService,
                             INetworkService networkService,
                             IFeatureToggleService featureToggleService)
        {
            _navigationService     = navigationService;
            _apiService            = apiService;
            _dictionaryService     = dictionaryService;
            _localStorageService   = localStorageService;
            _roamingStorageService = roamingStorageService;
            _analyticsService      = analyticsService;
            _networkService        = networkService;
            _featureToggleService  = featureToggleService;

            InitializeAsync();

            Messenger.Default.Register <NewTranslationMessage>(this, async(message) =>
            {
                await AddTranslationAsync(message.Translation);
            });

            Messenger.Default.Register <HistoryRemovedMessage>(this, async(message) =>
            {
                await CreateTranslationCardsAsync();
            });

            Messenger.Default.Register <HistoryToggleMessage>(this, (message) =>
            {
                HistoryShowed = _localStorageService.Read(StorageConstants.HistoryShowed, true);
            });
        }
示例#12
0
        public override bool OnBeginRecipe(object currentValue, out object newValue)
        {
            if (currentValue != null)
            {
                // Do not assign a new value, and return false to flag that
                // we don't want the current value to be changed.
                newValue = null;
                return(false);
            }

            IDictionaryService dictionaryService = (IDictionaryService)this.GetService(typeof(IDictionaryService));

            try
            {
                string solutionName = dictionaryService.GetValue("SolutionName").ToString();
                if (solutionName != "")
                {
                    if (solutionName.Contains("."))
                    {
                        //take the last element
                        solutionName = solutionName.Substring(0, solutionName.LastIndexOf("."));
                    }
                    newValue = solutionName;
                    return(true);
                }
            }
            catch (Exception)
            {
            }

            newValue = "DefaultNamespace";
            return(true);
        }
示例#13
0
        void ThrowIfRequiredArgumentsAreNull(IDictionaryService arguments)
        {
            bool requiredAreNull = false;

            if (Configuration.Arguments == null)
            {
                return;
            }

            IValueInfoService infoSvc        = GetService <IValueInfoService>(true);
            ArrayList         missingReqArgs = new ArrayList(Configuration.Arguments.Length);

            foreach (Config.Argument arg in Configuration.Arguments)
            {
                bool isNull = arguments.GetValue(arg.Name) == null;
                if (arg.Required && isNull)
                {
                    missingReqArgs.Add(arg.Name);
                }
                requiredAreNull = requiredAreNull || (arg.Required && isNull);
            }

            if (requiredAreNull)
            {
                throw new RecipeExecutionException(this.Configuration.Name, String.Format(
                                                       System.Globalization.CultureInfo.CurrentCulture,
                                                       Properties.Resources.Recipe_MissingRequiredArguments,
                                                       String.Join(", ", (string[])missingReqArgs.ToArray(typeof(string)))));
            }
        }
示例#14
0
        private void SetupInputs(IAction action, Configuration.Action config,
                                 IDictionary actions, IDictionaryService arguments)
        {
            if (config.Input != null)
            {
                // Set input properties.
                foreach (Configuration.Input parameter in config.Input)
                {
                    object value = null;
                    if (parameter.RecipeArgument != null)
                    {
                        value = arguments.GetValue(parameter.RecipeArgument);
                    }
                    else if (parameter.ActionOutput != null)
                    {
                        value = GetActionOutputValue(config, parameter, value);
                    }

                    // Retrieve the property using the type description also for extensibility.
                    PropertyDescriptor inprop = GetComponentProperty(action, parameter.Name);
                    if (inprop != null)
                    {
                        InputAttribute inputattr = (InputAttribute)inprop.Attributes[typeof(InputAttribute)];
                        if (inputattr == null)
                        {
                            throw new NotSupportedException(String.Format(
                                                                System.Globalization.CultureInfo.CurrentCulture,
                                                                Properties.Resources.Recipe_NotMarkedInput,
                                                                parameter.Name, config.Type));
                        }
                        if (inputattr.Required && (value == null ||
                                                   (value is String && ((String)value).Length == 0)))
                        {
                            throw new ArgumentNullException(parameter.Name,
                                                            Properties.Resources.General_ArgumentEmpty);
                        }
                        try
                        {
                            inprop.SetValue(action, value);
                        }
                        catch (TargetInvocationException tex)
                        {
                            // Throw with inner exception which contains the real error.
                            throw new NotSupportedException(String.Format(
                                                                System.Globalization.CultureInfo.CurrentCulture,
                                                                Properties.Resources.Recipe_CantSetActionProperty,
                                                                inprop.Name, config.Name), tex.InnerException);
                        }
                    }
                    else
                    {
                        throw new ActionExecutionException(
                                  this.Configuration.Name, config.Name,
                                  String.Format(System.Globalization.CultureInfo.CurrentCulture,
                                                Properties.Resources.Recipe_ActionPropertyMissing,
                                                parameter.Name, action.GetType()));
                    }
                }
            }
        }
            public MemberAttributes GetModifiers(IComponent comp)
            {
                ISite site = comp.Site;

                if (site != null)
                {
                    IDictionaryService dictionary = (IDictionaryService)site.GetService(typeof(IDictionaryService));

                    if (dictionary != null)
                    {
                        object value = dictionary.GetValue("Modifiers");

                        if (value is MemberAttributes)
                        {
                            return((MemberAttributes)value);
                        }
                    }
                }

                // Check to see if someone offered up a "DefaultModifiers" property so we can
                // decide a default.
                PropertyDescriptorCollection props = TypeDescriptor.GetProperties(comp);
                PropertyDescriptor           prop  = props["DefaultModifiers"];

                if (prop != null && prop.PropertyType == typeof(MemberAttributes))
                {
                    return((MemberAttributes)prop.GetValue(comp));
                }

                return(MemberAttributes.Private);
            }
        internal void AddBrandingPanel()
        {
            if (!HasBeenActivated)
            {
                string basePath   = "";
                string recipeName = "";
                Microsoft.VisualStudio.VSHelp.Help helpService = null;

                try
                {
                    IConfigurationService s = this.GetService(typeof(IConfigurationService)) as IConfigurationService;
                    basePath = s.BasePath;

                    helpService = (Microsoft.VisualStudio.VSHelp.Help)base.GetService(typeof(Microsoft.VisualStudio.VSHelp.Help));

                    IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;
                    recipeName = dictionaryService.GetValue("RecipeName").ToString();
                }
                catch
                {
                    //MessageBox.Show(ex.ToString());
                }

                bPanel = new BrandingPanel();
                this.Controls.Add(bPanel);
                bPanel.UpdateImage(GetBasePath());
                bPanel.UpdateHelpPage(basePath, recipeName, helpService);
            }
        }
示例#17
0
        protected void ReadArguments()
        {
            if (HasBeenActivated)
            {
                return;
            }
            //called once at the beginning by the system

            IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;

            SafeAppName           = GetStringValue(dictionaryService, "SafeAppName");
            ParentFeatureName     = GetStringValue(dictionaryService, "ParentFeatureName");
            ParentFeatureId       = GetStringValue(dictionaryService, "ParentFeatureId");
            FeatureID             = GetStringValue(dictionaryService, "FeatureID");
            FeatureName           = GetStringValue(dictionaryService, "FeatureName");
            FeatureTitle          = GetStringValue(dictionaryService, "FeatureTitle");
            FeatureDescription    = GetStringValue(dictionaryService, "FeatureDescription");
            FeatureScope          = GetStringValue(dictionaryService, "FeatureScope");
            FeatureHidden         = GetBooleanValue(dictionaryService, "FeatureHidden");
            FeatureCreateReceiver = GetBooleanValue(dictionaryService, "FeatureCreateReceiver");

            this.textBox_FeatureName.Text        = FeatureName;
            this.textBox_FeatureTitle.Text       = FeatureTitle;
            this.textBox_FeatureDescription.Text = FeatureDescription;
            checkBox_CreateReceiver.Checked      = FeatureCreateReceiver;
            checkBox_Hidden.Checked = FeatureHidden;
        }
示例#18
0
 public ArticleService(ILogger log, IArticleRepository articleRepo, IDictionaryService dictSrv, ISessionService sessionSrv) : base(log)
 {
     _dictSrv     = dictSrv;
     _articleRepo = articleRepo;
     _sessionSrv  = sessionSrv;
     _user        = _sessionSrv.GetFromSession <User>(SessionItem.User);
 }
示例#19
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IDictionaryService dictionaryService = (IDictionaryService)provider.GetService(typeof(IDictionaryService));

            initialDirectory = ArgumentsHelper.ReplaceToken(initialDirectoryExpression, dictionaryService);

            object svc = provider.GetService(typeof(IWindowsFormsEditorService));

            if (svc == null)
            {
                return(base.EditValue(context, provider, value));
            }

            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Title            = Title;
            fileDialog.InitialDirectory = InitialDirectory;
            fileDialog.Filter           = FileFilter;
            fileDialog.FilterIndex      = 1;
            fileDialog.RestoreDirectory = true;
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                return(fileDialog.FileName);
            }
            else
            {
                return(string.Empty);
            }
        }
示例#20
0
 public AnotherWordIntentHandlerStrategy(
     IWordService wordService,
     IDictionaryService dictionaryService,
     ICacheService cacheService
     ) : base(wordService, dictionaryService, cacheService)
 {
 }
示例#21
0
        protected override void Execute()
        {
            IDictionaryService dictionary = (IDictionaryService)
                                            GetService(typeof(IDictionaryService));

            dictionary.SetValue("AValue", "IPG");
        }
        public override bool OnBeforeActions(object currentValue, out object newValue)
        {
            if (currentValue != null)
            {
                // Do not assign a new value, and return false to flag that
                // we don't want the current value to be changed.
                newValue = null;
                return(false);
            }

            try
            {
                IDictionaryService dictionaryService = (IDictionaryService)ServiceHelper.GetService(this, typeof(IDictionaryService));
                string             argumentvalue     = dictionaryService.GetValue(RecipeArgument).ToString();
                argumentvalue = argumentvalue.Replace(" ", "");
                argumentvalue = argumentvalue.Replace("-", "");
                argumentvalue = argumentvalue.Replace("(", "");
                argumentvalue = argumentvalue.Replace(")", "");
                argumentvalue = argumentvalue.Replace("&", "");
                argumentvalue = argumentvalue.Replace("_", "");
                argumentvalue = argumentvalue.Replace(".", "_");
                newValue      = argumentvalue;
                return(true);
            }
            catch (Exception)
            {
            }

            newValue = null;
            return(false);
        }
示例#23
0
        public MainWindow(
            IAudioService audioService,
            IDictionaryService dictionaryService,
            IInputService inputService,
            IKeyStateService keyStateService)
        {
            InitializeComponent();

            this.audioService      = audioService;
            this.dictionaryService = dictionaryService;
            this.inputService      = inputService;
            this.keyStateService   = keyStateService;

            defaultPointSource    = inputService.PointSource;
            manualModePointSource = new MousePositionSource(Settings.Default.PointTtl)
            {
                State = RunningStates.Paused
            };

            managementWindowRequest        = new InteractionRequest <NotificationWithServicesAndState>();
            managementWindowRequestCommand = new DelegateCommand(RequestManagementWindow);
            toggleManualModeCommand        = new DelegateCommand(ToggleManualMode, () => !(defaultPointSource is MousePositionSource));
            quitCommand    = new DelegateCommand(Quit);
            backCommand    = new DelegateCommand(Back);
            restartCommand = new DelegateCommand(Restart);

            //Setup key binding (Alt+M and Shift+Alt+M) to open settings
            InputBindings.Add(new KeyBinding
            {
                Command   = managementWindowRequestCommand,
                Modifiers = ModifierKeys.Alt,
                Key       = Key.M
            });
            InputBindings.Add(new KeyBinding
            {
                Command   = managementWindowRequestCommand,
                Modifiers = ModifierKeys.Shift | ModifierKeys.Alt,
                Key       = Key.M
            });

            //Setup key binding (Alt+Enter and Shift+Alt+Enter) to open settings
            InputBindings.Add(new KeyBinding
            {
                Command   = toggleManualModeCommand,
                Modifiers = ModifierKeys.Alt,
                Key       = Key.Enter
            });
            InputBindings.Add(new KeyBinding
            {
                Command   = toggleManualModeCommand,
                Modifiers = ModifierKeys.Shift | ModifierKeys.Alt,
                Key       = Key.Enter
            });

            Title = string.Format(Properties.Resources.WINDOW_TITLE, DiagnosticInfo.AssemblyVersion);

            //Set the window size to 0x0 as this prevents a flicker where OptiKey would be displayed in the default position and then repositioned
            Width  = 0;
            Height = 0;
        }
示例#24
0
        public override bool OnBeginRecipe(object currentValue, out object newValue)
        {
            if (currentValue != null)
            {
                // Do not assign a new value, and return false to flag that
                // we don't want the current value to be changed.
                newValue = null;
                return(false);
            }

            IDictionaryService dictionaryService = (IDictionaryService)this.GetService(typeof(IDictionaryService));

            try
            {
                string itemname = dictionaryService.GetValue("ProjectName").ToString();
                if (itemname != "")
                {
                    newValue = itemname;
                    return(true);
                }
            }
            catch (Exception)
            {
            }

            newValue = null;
            return(false);
        }
示例#25
0
 public CategoryController(
     IDictionaryService dictionaryService,
     IMapper mapper)
 {
     _dictionaryService = dictionaryService;
     _mapper            = mapper;
 }
示例#26
0
        public MainWindow(
            IAudioService audioService,
            IDictionaryService dictionaryService,
            IInputService inputService,
            IKeyStateService keyStateService)
        {
            InitializeComponent();

            this.audioService      = audioService;
            this.dictionaryService = dictionaryService;
            this.inputService      = inputService;
            this.keyStateService   = keyStateService;

            managementWindowRequest        = new InteractionRequest <NotificationWithServicesAndState>();
            managementWindowRequestCommand = new DelegateCommand(RequestManagementWindow);
            quitCommand = new DelegateCommand(Quit);

            //Setup key binding (Alt-M and Shift-Alt-M) to open settings
            InputBindings.Add(new KeyBinding
            {
                Command   = managementWindowRequestCommand,
                Modifiers = ModifierKeys.Alt,
                Key       = Key.M
            });
            InputBindings.Add(new KeyBinding
            {
                Command   = managementWindowRequestCommand,
                Modifiers = ModifierKeys.Shift | ModifierKeys.Alt,
                Key       = Key.M
            });

            Title = string.Format(Properties.Resources.WINDOW_TITLE, DiagnosticInfo.AssemblyVersion);
        }
示例#27
0
        public override void Execute()
        {
            if (string.IsNullOrEmpty(RuntimeProviderBaseType))
            {
                RuntimeProviderBaseType = RuntimeProviderRootType;
            }

            IDictionaryService dictionaryService = GetService <IDictionaryService>();

            providerInfo                                 = new ProviderInfo();
            providerInfo.Namespace                       = Namespace;
            providerInfo.ExtendedNamespace               = ExtendedNamespace;
            providerInfo.NamespacesConfiguration         = NamespacesConfiguration;
            providerInfo.NamespacesRuntime               = NamespacesRuntime;
            providerInfo.ProviderName                    = ProviderName;
            providerInfo.RuntimeConfigurationBaseType    = RuntimeConfigurationBaseType;
            providerInfo.RuntimeProviderBaseType         = RuntimeProviderBaseType;
            providerInfo.RuntimeProviderRootType         = RuntimeProviderRootType;
            providerInfo.ConfigurationElementType        = ConfigurationElementType;
            providerInfo.IncludeConfigurationTypeElement = IncludeConfigurationTypeElement;
            providerInfo.RuntimeClassName                = !string.IsNullOrEmpty(RuntimeClassName) ? RuntimeClassName : GenerateRuntimeClassName();
            providerInfo.ConfigurationClassName          = !string.IsNullOrEmpty(ConfigurationClassName) ? ConfigurationClassName : GenerateConfigurationClassName();
            providerInfo.GenerateRuntimeConstructors     = GenerateRuntimeConstructors;

            DefaultRuntimeImplementationTemplate = ArgumentsHelper.ReplaceToken(DefaultRuntimeImplementationTemplate, dictionaryService);
        }
示例#28
0
        public InputService(
            IKeyStateService keyStateService,
            IDictionaryService dictionaryService,
            IAudioService audioService,
            ICapturingStateManager capturingStateManager,
            IPointSource pointSource,
            ITriggerSource keySelectionTriggerSource,
            ITriggerSource pointSelectionTriggerSource)
        {
            this.keyStateService             = keyStateService;
            this.dictionaryService           = dictionaryService;
            this.audioService                = audioService;
            this.capturingStateManager       = capturingStateManager;
            this.pointSource                 = pointSource;
            this.keySelectionTriggerSource   = keySelectionTriggerSource;
            this.pointSelectionTriggerSource = pointSelectionTriggerSource;

            //Fixation key triggers also need the enabled state info
            var fixationTrigger = keySelectionTriggerSource as IFixationTriggerSource;

            if (fixationTrigger != null)
            {
                fixationTrigger.KeyEnabledStates = keyStateService.KeyEnabledStates;
            }
        }
            public void ParseItem(IDictionaryService dictionaryService)
            {
                string templateContent = File.ReadAllText(this.originalFilename);

                Regex expression = new Regex("\\$(?<argumentName>\\S+?)\\$", RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.ExplicitCapture);

                if (dictionaryService != null)
                {
                    foreach (Match match in expression.Matches(templateContent))
                    {
                        Group matchGroup = match.Groups["argumentName"];

                        if (matchGroup.Success)
                        {
                            object value = dictionaryService.GetValue(matchGroup.Value);

                            if (value != null && value is string)
                            {
                                templateContent = templateContent.Replace(match.Value, (string)value);
                            }
                            else if (value != null)
                            {
                                templateContent = templateContent.Replace(match.Value, value.ToString());
                            }
                        }
                    }
                }

                Backup();


                File.WriteAllText(originalFilename, templateContent);
            }
示例#30
0
        void ExecuteActions(IDictionaryService readOnlyArguments,
                            IDictionaryService arguments, ITypeResolutionService resolution)
        {
            if (!HasActions())
            {
                return;
            }

            IActionCoordinationService coordinator = GetService <IActionCoordinationService>(true);

            LoadActionsFromConfiguration(resolution);

            try
            {
                // Don't let value providers/actions get a hook to the change service
                forbidChangeService = true;
                // Expose dictionary service as readonly to the action.
                using (SetupTemporaryService(typeof(IDictionaryService), readOnlyArguments))
                {
                    coordinator.Run(Configuration.Actions.GetIndexedActions(), Configuration.Actions.Any);
                }
            }
            catch (Exception ex)
            {
                UndoExecutedActionsAndRethrow(ex);
            }
            finally
            {
                forbidChangeService = false;
            }

            return;
        }
示例#31
0
        public MainViewModel(
            IAudioService audioService,
            ICalibrationService calibrationService,
            IDictionaryService dictionaryService,
            IKeyStateService keyStateService,
            ISuggestionStateService suggestionService,
            ICapturingStateManager capturingStateManager,
            ILastMouseActionStateManager lastMouseActionStateManager,
            IInputService inputService,
            IKeyboardOutputService keyboardOutputService,
            IMouseOutputService mouseOutputService,
            IWindowManipulationService mainWindowManipulationService,
            List<INotifyErrors> errorNotifyingServices)
        {
            this.audioService = audioService;
            this.calibrationService = calibrationService;
            this.dictionaryService = dictionaryService;
            this.keyStateService = keyStateService;
            this.suggestionService = suggestionService;
            this.capturingStateManager = capturingStateManager;
            this.lastMouseActionStateManager = lastMouseActionStateManager;
            this.inputService = inputService;
            this.keyboardOutputService = keyboardOutputService;
            this.mouseOutputService = mouseOutputService;
            this.mainWindowManipulationService = mainWindowManipulationService;
            this.errorNotifyingServices = errorNotifyingServices;

            calibrateRequest = new InteractionRequest<NotificationWithCalibrationResult>();
            SelectionMode = SelectionModes.Key;

            InitialiseKeyboard(mainWindowManipulationService);
            AttachScratchpadEnabledListener();
            AttachKeyboardSupportsCollapsedDockListener(mainWindowManipulationService);
            AttachKeyboardSupportsSimulateKeyStrokesListener();
        }
示例#32
0
 /// <summary>
 /// 静态构造方法。
 /// </summary>
 static MultipleListControl()
 {
     using (var container = AutofacConfig.Container.BeginLifetimeScope())
     {
         _dictionaryService = container.Resolve<IDictionaryService>();
     }
 }
 public ProjectsController(IProjectService projectService, IDictionaryService dictionaryService, ISprintService spirntService, ApplicationUserManager applicationUserManager)
 {
     _projectService = projectService;
     _dictionaryService = dictionaryService;
     _sprintService = spirntService;
     _applicationUserManager = applicationUserManager;
 }
示例#34
0
 public BaseController()
 {
     _accountService = DependencyResolver.Current.GetService<IAccountService>();
     _dictionaryService = DependencyResolver.Current.GetService<IDictionaryService>();
     CacheService = CacheProvider.Current.GetCache();
     _adminData = DependencyResolver.Current.GetService<IAdminScheduleService>();
 }
示例#35
0
        public MainWindow(
            IAudioService audioService,
            IDictionaryService dictionaryService,
            IInputService inputService)
        {
            InitializeComponent();

            this.audioService = audioService;
            this.dictionaryService = dictionaryService;
            this.inputService = inputService;

            managementWindowRequest = new InteractionRequest<NotificationWithServices>();

            //Setup key binding (Alt-C and Shift-Alt-C) to open settings
            InputBindings.Add(new KeyBinding
            {
                Command = new DelegateCommand(RequestManagementWindow),
                Modifiers = ModifierKeys.Alt,
                Key = Key.M
            });
            InputBindings.Add(new KeyBinding
            {
                Command = new DelegateCommand(RequestManagementWindow),
                Modifiers = ModifierKeys.Shift | ModifierKeys.Alt,
                Key = Key.M
            });

            Title = string.Format(Properties.Resources.WINDOW_TITLE, DiagnosticInfo.AssemblyVersion);
        }
 public ManagerController(ApplicationUserManager userManager, IAssignmentService assignmentService, IDictionaryService dictionaryService, ISprintService sprintService, IProjectService projectService)
 {
     this._userManager = userManager;
     this._assignmentService = assignmentService;
     this._dictionaryService = dictionaryService;
     this._sprintService = sprintService;
     this._projectService = projectService;
 }
示例#37
0
 public DictionaryViewModel(IDictionaryService dictionaryService)
 {
     this.dictionaryService = dictionaryService;
 
     AddCommand = new DelegateCommand(Add, () => !string.IsNullOrEmpty(NewEntry));
     ToggleDeleteCommand = new DelegateCommand<string>(ToggleDelete, e => !string.IsNullOrEmpty(e));
 
     Load();
 }
        public void SetUp()
        {
            dictionary = new MockDictionaryService();
            view = new MockSolutionPropertiesPage();
            model = new SolutionPropertiesModel( dictionary );
            presenter = new SolutionPropertiesPagePresenter(view, model);

            dictionary.SetValue("CompositeWebDlls", "CompositeWeb.dll.txt");
            dictionary.SetValue("EnterpriseLibraryDlls", "EntLib.dll.txt");
        }
示例#39
0
        public ManagementWindow(
            IAudioService audioService,
            IDictionaryService dictionaryService)
        {
            InitializeComponent();

            //Instantiate ManagementViewModel and set as DataContext of ManagementView
            var managementViewModel = new ManagementViewModel(audioService, dictionaryService);
            this.ManagementView.DataContext = managementViewModel;
        }
 /// <summary>
 /// Evaluates an expression using <see cref="ExpressionEvaluationService"/>
 /// </summary>
 /// <param name="dictionary">An instance of <see cref="IDictionaryService"/></param>
 /// <param name="expression">Expression to evaluate</param>
 /// <returns>The result as an object</returns>
 public static object EvaluateExpression(IDictionaryService dictionary, string expression)
 {
     ExpressionEvaluationService evaluator = new ExpressionEvaluationService();
     object result = null;
     try
     {
         result = evaluator.Evaluate(expression, new ServiceAdapterDictionary(dictionary));
     }
     catch { }
     return result;
 }
示例#41
0
        public static void AddDictionaryService(string id, IDictionaryService ds)
        {
            if (ds == null)
            {
                throw new ArgumentNullException(string.Format("Dictionary Service can not be null."));
            }

            lock (syncRoot)
            {
                dsDic[id] = ds;
            }
        }
示例#42
0
        public OutputService(
            IKeyboardService keyboardService,
            ISuggestionStateService suggestionService,
            IPublishService publishService,
            IDictionaryService dictionaryService)
        {
            this.keyboardService = keyboardService;
            this.suggestionService = suggestionService;
            this.publishService = publishService;
            this.dictionaryService = dictionaryService;

            ReactToPublishingStateChanges();
            ReactToPublishableKeyDownStateChanges();
        }
示例#43
0
        public ManagementViewModel(
            IAudioService audioService,
            IDictionaryService dictionaryService)
        {
            //Instantiate child VMs
            DictionaryViewModel = new DictionaryViewModel(dictionaryService);
            OtherViewModel = new OtherViewModel();
            PointingAndSelectingViewModel = new PointingAndSelectingViewModel();
            SoundsViewModel = new SoundsViewModel(audioService);
            VisualsViewModel = new VisualsViewModel();
            WordsViewModel = new WordsViewModel(dictionaryService);

            //Instantiate interaction requests and commands
            ConfirmationRequest = new InteractionRequest<Confirmation>();
            OkCommand = new DelegateCommand<Window>(Ok); //Can always click Ok
            CancelCommand = new DelegateCommand<Window>(Cancel); //Can always click Cancel
        }
        private string GetStringValue(IDictionaryService dictionaryService, string name)
        {
            try
            {
                object v = dictionaryService.GetValue(name);
                if (v != null)
                {

                    return v.ToString();
                }
                return "";
            }
            catch (Exception)
            {
                throw new Exception("Could not find argument " + name);
            }
        }
示例#45
0
        public KeyboardOutputService(
            IKeyStateService keyStateService,
            ISuggestionStateService suggestionService,
            IPublishService publishService,
            IDictionaryService dictionaryService,
            Action<KeyValue> fireKeySelectionEvent)
        {
            this.keyStateService = keyStateService;
            this.suggestionService = suggestionService;
            this.publishService = publishService;
            this.dictionaryService = dictionaryService;
            this.fireKeySelectionEvent = fireKeySelectionEvent;

            ReactToSimulateKeyStrokesChanges();
            ReactToShiftStateChanges();
            ReactToPublishableKeyDownStateChanges();
            ReactToKeyboardIsShiftAwareChanges();
            ReactToSuppressAutoCapitaliseIntelligentlyChanges();
            AutoPressShiftIfAppropriate();
        }
示例#46
0
        public MainViewModel(
            IAudioService audioService,
            ICalibrationService calibrationService,
            IDictionaryService dictionaryService,
            IKeyboardService keyboardService,
            ISuggestionStateService suggestionService,
            ICapturingStateManager capturingStateManager,
            ILastMouseActionStateManager lastMouseActionStateManager,
            IInputService inputService,
            IOutputService outputService,
            IWindowManipulationService mainWindowManipulationService,
            List<INotifyErrors> errorNotifyingServices)
        {
            Log.Debug("Ctor called.");

            this.audioService = audioService;
            this.calibrationService = calibrationService;
            this.dictionaryService = dictionaryService;
            this.keyboardService = keyboardService;
            this.suggestionService = suggestionService;
            this.capturingStateManager = capturingStateManager;
            this.lastMouseActionStateManager = lastMouseActionStateManager;
            this.inputService = inputService;
            this.outputService = outputService;
            this.mainWindowManipulationService = mainWindowManipulationService;
            this.errorNotifyingServices = errorNotifyingServices;

            calibrateRequest = new InteractionRequest<NotificationWithCalibrationResult>();

            SelectionMode = SelectionModes.Key;
            Keyboard = new Alpha();

            SelectKeyboardOnKeyboardSetChanges();
            AttachScratchpadEnabledListener();

            HandleFunctionKeySelectionResult(KeyValues.LeftShiftKey); //Set initial shift state to on
        }
示例#47
0
        public InputService(
            IKeyStateService keyStateService,
            IDictionaryService dictionaryService,
            IAudioService audioService,
            ICapturingStateManager capturingStateManager,
            IPointSource pointSource,
            ITriggerSource keySelectionTriggerSource,
            ITriggerSource pointSelectionTriggerSource)
        {
            this.keyStateService = keyStateService;
            this.dictionaryService = dictionaryService;
            this.audioService = audioService;
            this.capturingStateManager = capturingStateManager;
            this.pointSource = pointSource;
            this.keySelectionTriggerSource = keySelectionTriggerSource;
            this.pointSelectionTriggerSource = pointSelectionTriggerSource;

            //Fixation key triggers also need the enabled state info
            var fixationTrigger = keySelectionTriggerSource as IFixationTriggerSource;
            if (fixationTrigger != null)
            {
                fixationTrigger.KeyEnabledStates = keyStateService.KeyEnabledStates;
            }
        }
示例#48
0
        public MainWindow(
            IAudioService audioService,
            IDictionaryService dictionaryService,
            IInputService inputService)
        {
            InitializeComponent();

            this.audioService = audioService;
            this.dictionaryService = dictionaryService;
            this.inputService = inputService;

            managementWindowRequest = new InteractionRequest<NotificationWithServices>();

            //Setup key binding (Alt-C) to open settings
            var openSettingsKeyBinding = new KeyBinding
            {
                Command = new DelegateCommand(RequestManagementWindow),
                Modifiers = ModifierKeys.Alt,
                Key = Key.M
            };
            InputBindings.Add(openSettingsKeyBinding);

            Title = string.Format("OptiKey v{0}", DiagnosticInfo.AssemblyVersion);
        }
 public void FixtureSetUp()
 {
     host = new ConfigurationDesignHost();
     service = host.GetService(typeof(IDictionaryService)) as IDictionaryService;
 }
 public CreateViewPageBaseModel(IDictionaryService dictionary, ISolutionModel solutionModel, IServiceProvider serviceProvider)
 {
     _dictionary = dictionary;
     _solutionModel = solutionModel;
     _serviceProvider = serviceProvider;
 }
 protected CreateViewPageBaseModel CreateModel(IDictionaryService dictionary, ISolutionModel solution, ISite Site)
 {
     return new CreateViewPageBaseModel(dictionary, solution, Site);
 }
			protected override void OnSited()
			{
				base.OnSited();
				dictionaryService = (IDictionaryService)GetService(typeof(IDictionaryService));
			}
 public void SetUp()
 {
     dictionary = new MockDictionaryService();
     solutionModel = new MockSolutionModel(null);
     model = new CreateModulePageModel(dictionary, solutionModel, null);
 }
 public SolutionPropertiesModel(IDictionaryService dictionary)
 {
     this.dictionary = dictionary;
 }
示例#55
0
        public WordsViewModel(IDictionaryService dictionaryService)
        {
            this.dictionaryService = dictionaryService;

            Load();
        }
			private bool GetBooleanValue(IDictionaryService dictionaryService, string name)
			{
                try
                {
                    return Boolean.Parse(GetStringValue(dictionaryService, name));
                }
                catch (Exception)
                {
                }
                return false;
			}
            public void ParseItem(IDictionaryService dictionaryService)
            {
                string templateContent = File.ReadAllText(this.originalFilename);

                Regex expression = new Regex("\\$(?<argumentName>\\S+?)\\$", RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.ExplicitCapture);

                if (dictionaryService != null)
                {
                    foreach (Match match in expression.Matches(templateContent))
                    {
                        Group matchGroup = match.Groups["argumentName"];

                        if (matchGroup.Success)
                        {
                            object value = dictionaryService.GetValue(matchGroup.Value);

                            if (value != null && value is string)
                            {
                                templateContent = templateContent.Replace(match.Value, (string)value);
                            }
                            else if (value != null)
                            {
                                templateContent = templateContent.Replace(match.Value, value.ToString());
                            }
                        }
                    }
                }

                Backup();

                File.WriteAllText(originalFilename, templateContent);
            }
 public CreateFoundationalModulePageModel(IDictionaryService dictionary, ISolutionModel solutionModel, IServiceProvider serviceProvider)
 {
     this.dictionary = dictionary;
     this.solutionModel = solutionModel;
     this.serviceProvider = serviceProvider;
 }
示例#59
0
        private static IInputService CreateInputService(
            IKeyStateService keyStateService,
            IDictionaryService dictionaryService,
            IAudioService audioService,
            ICalibrationService calibrationService,
            ICapturingStateManager capturingStateManager,
            List<INotifyErrors> errorNotifyingServices)
        {
            Log.Info("Creating InputService.");

            //Instantiate point source
            IPointSource pointSource;
            switch (Settings.Default.PointsSource)
            {
                case PointsSources.GazeTracker:
                    pointSource = new GazeTrackerSource(
                        Settings.Default.PointTtl,
                        Settings.Default.GazeTrackerUdpPort,
                        new Regex(GazeTrackerUdpRegex));
                    break;

                case PointsSources.TheEyeTribe:
                    var theEyeTribePointService = new TheEyeTribePointService();
                    errorNotifyingServices.Add(theEyeTribePointService);
                    pointSource = new PointServiceSource(
                        Settings.Default.PointTtl,
                        theEyeTribePointService);
                    break;

                case PointsSources.TobiiEyeX:
                case PointsSources.TobiiRex:
                case PointsSources.TobiiPcEyeGo:
                    var tobiiEyeXPointService = new TobiiEyeXPointService();
                    var tobiiEyeXCalibrationService = calibrationService as TobiiEyeXCalibrationService;
                    if (tobiiEyeXCalibrationService != null)
                    {
                        tobiiEyeXCalibrationService.EyeXHost = tobiiEyeXPointService.EyeXHost;
                    }
                    errorNotifyingServices.Add(tobiiEyeXPointService);
                    pointSource = new PointServiceSource(
                        Settings.Default.PointTtl,
                        tobiiEyeXPointService);
                    break;

                case PointsSources.MousePosition:
                    pointSource = new MousePositionSource(
                        Settings.Default.PointTtl);
                    break;

                default:
                    throw new ArgumentException("'PointsSource' settings is missing or not recognised! Please correct and restart OptiKey.");
            }

            //Instantiate key trigger source
            ITriggerSource keySelectionTriggerSource;
            switch (Settings.Default.KeySelectionTriggerSource)
            {
                case TriggerSources.Fixations:
                    keySelectionTriggerSource = new KeyFixationSource(
                       Settings.Default.KeySelectionTriggerFixationLockOnTime,
                       Settings.Default.KeySelectionTriggerFixationResumeRequiresLockOn,
                       Settings.Default.KeySelectionTriggerFixationDefaultCompleteTime,
                       Settings.Default.KeySelectionTriggerFixationCompleteTimesByIndividualKey
                        ? Settings.Default.KeySelectionTriggerFixationCompleteTimesByKeyValues
                        : null, 
                       Settings.Default.KeySelectionTriggerIncompleteFixationTtl,
                       pointSource.Sequence);
                    break;

                case TriggerSources.KeyboardKeyDownsUps:
                    keySelectionTriggerSource = new KeyboardKeyDownUpSource(
                        Settings.Default.KeySelectionTriggerKeyboardKeyDownUpKey,
                        pointSource.Sequence);
                    break;

                case TriggerSources.MouseButtonDownUps:
                    keySelectionTriggerSource = new MouseButtonDownUpSource(
                        Settings.Default.KeySelectionTriggerMouseDownUpButton,
                        pointSource.Sequence);
                    break;

                default:
                    throw new ArgumentException(
                        "'KeySelectionTriggerSource' setting is missing or not recognised! Please correct and restart OptiKey.");
            }

            //Instantiate point trigger source
            ITriggerSource pointSelectionTriggerSource;
            switch (Settings.Default.PointSelectionTriggerSource)
            {
                case TriggerSources.Fixations:
                    pointSelectionTriggerSource = new PointFixationSource(
                        Settings.Default.PointSelectionTriggerFixationLockOnTime,
                        Settings.Default.PointSelectionTriggerFixationCompleteTime,
                        Settings.Default.PointSelectionTriggerLockOnRadiusInPixels,
                        Settings.Default.PointSelectionTriggerFixationRadiusInPixels,
                        pointSource.Sequence);
                    break;

                case TriggerSources.KeyboardKeyDownsUps:
                    pointSelectionTriggerSource = new KeyboardKeyDownUpSource(
                        Settings.Default.PointSelectionTriggerKeyboardKeyDownUpKey,
                        pointSource.Sequence);
                    break;

                case TriggerSources.MouseButtonDownUps:
                    pointSelectionTriggerSource = new MouseButtonDownUpSource(
                        Settings.Default.PointSelectionTriggerMouseDownUpButton,
                        pointSource.Sequence);
                    break;

                default:
                    throw new ArgumentException(
                        "'PointSelectionTriggerSource' setting is missing or not recognised! "
                        + "Please correct and restart OptiKey.");
            }

            var inputService = new InputService(keyStateService, dictionaryService, audioService, capturingStateManager,
                pointSource, keySelectionTriggerSource, pointSelectionTriggerSource);
            inputService.RequestSuspend(); //Pause it initially
            return inputService;
        }
示例#60
0
		/// <summary>
		/// Replaces parameters in the format used by VS templates ($ArgumentName$) 
		/// using the values in the replacement dictionary provided.
		/// </summary>
		/// <remarks>
		/// The replacement is performed for multiple parameters. However, if a 
		/// parameter doesn't have a value in the dictionary, replacement of 
		/// further parameters will stop and the resulting string returned as-is, 
		/// with the values replaced so far, and the remaining parameters.
		/// </remarks>
		public static string ReplaceParameters(string value, IDictionaryService dictionary)
		{
			if(dictionary != null)
			{
				int begin = value.IndexOf("$");
				int end = value.IndexOf("$", begin + 1);
				if(begin != -1 && end != -1 && begin != end)
				{
					string key = value.Substring(begin + 1, (end - begin) - 1);
					object newvalue = dictionary.GetValue(key);
					if(newvalue != null)
					{
						// Make it recursive to support multiple parameters.
						return ReplaceParameters(value.Replace("$" + key + "$", newvalue.ToString()), dictionary);
					}
				}
			}
			return value;
		}