Ejemplo n.º 1
0
 public ScrollingStrategy( DispatcherTimer timer, List<IHighlightableElement> elements, IPluginConfigAccessor configuration )
 {
     _elements = elements;
     _timer = timer;
     _currentElementParents = new Stack<IHighlightableElement>();
     _configuration = configuration;
 }
Ejemplo n.º 2
0
        public VMIContextViewModel( IContext context, IPluginConfigAccessor config, ILogService logService, IHelpService helpService )
        {
            DisplayName = "Object explorer";

            Context = context;
            Config = config;
            HelpService = helpService;

            InitializeCommands();

            _plugins = new Dictionary<IPluginInfo, VMIPlugin>();
            _allServices = new Dictionary<IServiceInfo, VMIService>();
            _dynamicServices = new Dictionary<IServiceInfo, VMIService>();
            _serviceRefs = new Dictionary<IServiceReferenceInfo, VMIService>();
            _assemblies = new Dictionary<IAssemblyInfo, VMIAssembly>();

            _pluginRunner = Context.GetService<PluginRunner>( true );
            _pluginRunner.ApplyDone += new EventHandler<ApplyDoneEventArgs>( OnApplyDone );

            NotificationService = context.GetService<INotificationService>();

            Assemblies = new VMCollection<VMIAssembly, IAssemblyInfo>( PluginRunner.Discoverer.AllAssemblies, FindOrCreate );
            Plugins = new VMCollection<VMIPlugin, IPluginInfo>( PluginRunner.Discoverer.AllPlugins.OrderBy( p => p.PublicName ), FindOrCreate );
            AllServices = new VMCollection<VMIService, IServiceInfo>( PluginRunner.Discoverer.AllServices, FindOrCreate );
            DynamicServices = new VMCollection<VMIService, IServiceInfo>( PluginRunner.Discoverer.AllServices.Where( p => p.IsDynamicService ), FindOrCreateDynamic );
            Categories = new ObservableCollection<VMIFolder>();

            _vmLogConfig = new VMLogConfig( this, logService );
            _vmLogConfig.Initialize();

            OsInfo = new VMOSInfo( this );

            VMApplicationInfo = new VMApplicationInfo( this );

            Dictionary<string, List<IPluginInfo>> categoryFolders = new Dictionary<string, List<IPluginInfo>>();
            foreach( IPluginInfo plugin in PluginRunner.Discoverer.AllPlugins )
            {
                foreach( string categ in plugin.Categories )
                {
                    List<IPluginInfo> col;
                    if( !categoryFolders.TryGetValue( categ, out col ) )
                    {
                        col = new List<IPluginInfo>();
                        col.Add( plugin );
                        categoryFolders.Add( categ, col );
                    }
                    else
                    {
                        col.Add( plugin );
                    }
                }
            }
            foreach( KeyValuePair<string, List<IPluginInfo>> item in categoryFolders )
            {
                VMCollection<VMAlias<VMIPlugin>, IPluginInfo> collection = new VMCollection<VMAlias<VMIPlugin>, IPluginInfo>( item.Value, ( info ) => { return new VMAlias<VMIPlugin>( FindOrCreate( info ), null ); } );
                VMIFolder folder = new VMIFolder( collection, item.Key );
                Categories.Add( folder );
            }
        }
Ejemplo n.º 3
0
        public EditorViewModel( IPluginConfigAccessor scrollConfig, IPluginConfigAccessor keyboardTriggerConfig, ITriggerService triggerService )
        {
            _scrollConfig = scrollConfig;
            _keyboardTriggerConfig = keyboardTriggerConfig;
            _triggerService = triggerService;

            _currentIndexStrategy = StrategyBridge.AvailableStrategies.IndexOf( _scrollConfig.User.GetOrSet( "Strategy", "ZoneScrollingStrategy" ) );
            this.DisplayName = R.ScrollEditor;
        }
Ejemplo n.º 4
0
 public TurboScrollingStrategy( DispatcherTimer timer, List<IHighlightableElement> elements, IPluginConfigAccessor configuration )
     : base(timer, elements, configuration)
 {
     _normalInterval = _timer.Interval;
     TurboInterval = new TimeSpan( 0, 0, 0, 0, _configuration.User.GetOrSet( "TurboSpeed", 100 ) );
     _normalSpeedTimer = new DispatcherTimer( DispatcherPriority.Normal );
     _normalSpeedTimer.Interval = new TimeSpan( 0, 0, 0, 0, 5000 );
     _normalSpeedTimer.Tick += ( o, e ) => SetNormalIntervalTimerInterval();
 }
Ejemplo n.º 5
0
        public EditorViewModel( IPluginConfigAccessor scrollConfig, IPluginConfigAccessor keyboardTriggerConfig, IKeyboardDriver keyboardHook, IPointerDeviceDriver pointerHook )
        {
            _scrollConfig = scrollConfig;
            _keyboardTriggerConfig = keyboardTriggerConfig;

            _keyboardHook = keyboardHook;
            _pointerHook = pointerHook;
            _currentIndexStrategy = KeyScrollerPlugin.AvailableStrategies.IndexOf(_scrollConfig.User.GetOrSet( "Strategy", "BasicScrollingStrategy" ));
            this.DisplayName = R.ScrollEditor;
        }
Ejemplo n.º 6
0
 private static void Key150To160( IPluginConfigAccessor simpleSkinConfigAccessor, IKey k )
 {
     //Prior to SimpleSkin plugin v1.6.0 the images were stored in the plugin datas of the layoutkeymodes
     //Since this version, the images are on the keymodes
     foreach( var layoutKeyMode in k.CurrentLayout.LayoutKeyModes )
     {
         PropertyMigrationLayoutKeyModeToKeyMode( simpleSkinConfigAccessor, layoutKeyMode, "Image" );
         PropertyMigrationLayoutKeyModeToKeyMode( simpleSkinConfigAccessor, layoutKeyMode, "DisplayType" );
     }
 }
Ejemplo n.º 7
0
 private static void PropertyMigrationLayoutKeyModeToKeyMode( IPluginConfigAccessor simpleSkinConfigAccessor, ILayoutKeyMode lkm, string propertyName )
 {
     object obj = simpleSkinConfigAccessor[lkm][propertyName];
     simpleSkinConfigAccessor[lkm].Remove( propertyName );
     if( obj != null )
     {
         IKeyboardMode mode = lkm.Mode;
         IKeyMode bestMatch = lkm.Key.KeyModes.FindBest( mode );
         if( bestMatch.Mode.ContainsAll( mode ) && mode.ContainsAll( bestMatch.Mode ) )
         {
             simpleSkinConfigAccessor[bestMatch].Set( propertyName, obj );
         }
     }
 }
Ejemplo n.º 8
0
        public EditorViewModel( IKeyboardContext ctx, IPluginConfigAccessor config )
        {
            DisplayName = "";

            _ctx = ctx;
            _config = config;
            _zoneCache = new Dictionary<ILayoutZone, LayoutZoneViewModel>();

            SelectedHolder = _ctx.CurrentKeyboard.CurrentLayout;
            Zones = new VMCollection<LayoutZoneViewModel, ILayoutZone>( _ctx.CurrentKeyboard.CurrentLayout.LayoutZones, FindOrCreate );

            _ctx.CurrentKeyboardChanged += new EventHandler<CurrentKeyboardChangedEventArgs>( OnCurrentKeyboardChanged );
            _config.ConfigChanged += new EventHandler<ConfigChangedEventArgs>( OnLayoutConfigChanged );
        }
Ejemplo n.º 9
0
 internal static void EnsureKeyVersion( IPluginConfigAccessor simpleSkinConfigAccessor, IKey k )
 {
     if( simpleSkinConfigAccessor[k] != null )
     {
         object o = simpleSkinConfigAccessor[k.CurrentLayout.LayoutKeyModes.FindBest( k.Context.EmptyMode )]["[PluginDataVersion]"];
         if( o != null )
         {
             Version v;
             if( Version.TryParse( o.ToString(), out v ) )
             {
                 if( v < new Version( "1.6.0" ) )
                 {
                     Key150To160( simpleSkinConfigAccessor, k );
                 }
             }
         }
     }
 }
Ejemplo n.º 10
0
        public StrategyBridge( DispatcherTimer timer, Func<ICKReadOnlyList<IHighlightableElement>> getElements, IPluginConfigAccessor config )
        {
            Implementations = new Dictionary<string, IScrollingStrategy>();

            foreach( Type t in GetStrategyTypes() )
            {
                //Ignore some types
                if( t == typeof( IScrollingStrategy ) || t == typeof( StrategyBridge ) || t == typeof( ScrollingStrategyBase ) )
                    continue;

                IScrollingStrategy instance = (IScrollingStrategy)Activator.CreateInstance( t );
                instance.Setup( timer, getElements, config );

                if( Implementations.ContainsKey( instance.Name ) )
                    throw new InvalidOperationException( "Cannot register the duplicate strategy name : " + instance.Name );

                Implementations[instance.Name] = instance;
            }

            _current = Implementations.Values.FirstOrDefault();
            if( _current == null )
                throw new InvalidOperationException( "One scrolling strategy at least must be available" );
        }
Ejemplo n.º 11
0
 public void UpdateFrom( IPluginConfigAccessor config )
 {
     string path = this.Name + "_logoptions";
     if( config.User[path] != null )
     {
         LogOptions = (ServiceLogEventOptions)config.User[path];
     }
 }
Ejemplo n.º 12
0
 public void UpdateFrom( IPluginConfigAccessor config )
 {
     string path = this.Name + "_dolog";
     if( config.User[path] != null )
     {
         DoLog = (bool)config.User["path"];
     }
     foreach( VMLogEventConfig e in Events )
     {
         e.UpdateFrom( config );
     }
     foreach( VMLogMethodConfig m in Methods )
     {
         m.UpdateFrom( config );
     }
     //foreach( VMLogPropertyConfig p in Properties )
     //{
     //    p.UpdateFrom( config );
     //}
 }
Ejemplo n.º 13
0
 public BasicScrollingStrategy( DispatcherTimer timer, List<IHighlightableElement> elements, IPluginConfigAccessor configuration )
     : base(timer, elements, configuration)
 {
 }
 public virtual void Setup( DispatcherTimer timer, Func<ICKReadOnlyList<IHighlightableElement>> getElements, IPluginConfigAccessor config )
 {
     Timer = timer;
     GetElements = getElements;
     Configuration = config;
 }
Ejemplo n.º 15
0
 public void UpdateFrom( IPluginConfigAccessor config )
 {
     LogOptions = config.User.GetOrSet( _logOptionsDataPath, ServiceLogMethodOptions.LogError );
 }
Ejemplo n.º 16
0
 public void Setup( DispatcherTimer timer, Func<ICKReadOnlyList<IHighlightableElement>> getElements, IPluginConfigAccessor config )
 {
     _current.Setup( timer, getElements, config );
 }
        public override void Setup( DispatcherTimer timer, Func<ICKReadOnlyList<IHighlightableElement>> elements, IPluginConfigAccessor config )
        {
            base.Setup( timer, elements, config );

            _normalInterval = Timer.Interval;
            TurboInterval = new TimeSpan(0, 0, 0, 0, Configuration.User.GetOrSet( "TurboSpeed", 100 ));
            _normalSpeedTimer = new DispatcherTimer();
            _normalSpeedTimer.Interval = new TimeSpan(0, 0, 0, 5);
            _normalSpeedTimer.Tick += ( o, e ) => SetTurboWithCheck();
            Timer.Tick += ( o, e ) => { if( IsTurboMode ) SetTurboWithCheck(); };
        }
Ejemplo n.º 18
0
 public EditorViewModel( IPluginConfigAccessor conf, IContext ctx )
 {
     _config = conf;
     _context = ctx;
 }
        //private bool _isCurrentImageFromIcon;
        //bool _useFileIcon;
        //public bool UseFileIcon
        //{
        //    get { return _useFileIcon; }
        //    set
        //    {
        //        if( _useFileIcon != value )
        //        {
        //            _useFileIcon = value;
        //            NotifyPropertyChanged( "UseFileIcon" );
        //            if( value && _selectedWildFile != null )
        //            {
        //                //Set the icon
        //                _skinConfigAccessor[Root.EditedKeyMode].Set( "Image", _selectedWildFile.Icon );
        //                _skinConfigAccessor[Root.EditedKeyMode].Set( "DisplayType", "Image" );
        //                _isCurrentImageFromIcon = true;
        //            }
        //            else
        //            {
        //                //Remove the icon
        //            }
        //        }
        //    }
        //}
        public FileLauncherCommandParameterManager( IFileLauncherService fileLauncher, IPluginConfigAccessor skinConfigAccessor )
        {
            _fileLauncher = fileLauncher;
            _skinConfigAccessor = skinConfigAccessor;

            TypeSelections = new List<FileLauncherTypeSelection>();
            SelectedFileLauncherType = new FileLauncherTypeSelection( this, FileLauncherType.Url, "URL" );
            SelectedFileLauncherType.IsSelected = true;
            TypeSelections.Add( SelectedFileLauncherType );
            TypeSelections.Add( new FileLauncherTypeSelection (this, FileLauncherType.Registry, "Application installée"));
            TypeSelections.Add( new FileLauncherTypeSelection( this, FileLauncherType.Browse, "Choisir un fichier" ) );
        }
Ejemplo n.º 20
0
 public EditorViewModel( IPluginConfigAccessor conf )
 {
     _config = conf;
     base.DisplayName = R.RadarConfiguration;
 }
Ejemplo n.º 21
0
 internal void UpdateFrom( IPluginConfigAccessor config )
 {
     if( config.User[GLOBAL_LOGS] != null )
     {
         DoLog = (bool)config.User[GLOBAL_LOGS];
     }
     foreach( VMLogServiceConfig service in Services )
     {
         service.UpdateFrom( config );
     }
 }