Example #1
0
 public SettingsControl(PluginInitContext context, SettingsViewModel viewModel)
 {
     InitializeComponent();
     _context = context;
     _settings = viewModel.Settings;
     DataContext = viewModel;
 }
Example #2
0
 public ProgramSetting(PluginInitContext context, Settings settings)
 {
     this.context = context;
     InitializeComponent();
     Loaded += Setting_Loaded;
     _settings = settings;
 }
Example #3
0
        protected override void InitInternal(PluginInitContext context)
        {
            this.context = context;

            if (UserSettingStorage.Instance.WebSearches == null)
                UserSettingStorage.Instance.WebSearches = UserSettingStorage.Instance.LoadDefaultWebSearches();
        }
Example #4
0
        public void Init(PluginInitContext context)
        {
            var dir = new DirectoryInfo(@"Plugins\Wox.Plugin.ServerCodes\Codes");	// папка с файлами
			
			// получаем полный путь к файлу и потом вычищаем ненужное, оставляем только имя файла. 
			_files = dir.GetFiles("*.txt").Select(file => Path.GetFileNameWithoutExtension(file.FullName)).ToList();
        }
Example #5
0
 public WebSearchSetting(WebSearchesSetting settingWidow)
 {
     _plguin = settingWidow.Plugin;
     _context = settingWidow.Context;
     _settingWindow = settingWidow;
     InitializeComponent();
 }
Example #6
0
        public ProgramSuffixes(PluginInitContext context)
        {
            this.context = context;
            InitializeComponent();

            tbSuffixes.Text = ProgramStorage.Instance.ProgramSuffixes;
        }
Example #7
0
 public ProgramSuffixes(PluginInitContext context, Settings settings)
 {
     this.context = context;
     InitializeComponent();
     _settings = settings;
     tbSuffixes.Text = string.Join(ProgramSource.SuffixSeperator.ToString(), _settings.ProgramSuffixes);
 }
Example #8
0
File: Sys.cs Project: pluto92/Wox
 protected override void InitInternal(PluginInitContext context)
 {
     availableResults.Add(new Result
     {
         Title = "Shutdown",
         SubTitle = "Shutdown Computer",
         Score = 100,
         IcoPath = "Images\\exit.png",
         Action = (c) => Process.Start("shutdown","/s /t 0")
     });
     availableResults.Add(new Result
     {
         Title = "Log off",
         SubTitle = "Log off current user",
         Score = 20,
         IcoPath = "Images\\logoff.png",
         Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
     });
     availableResults.Add(new Result
     {
         Title = "Lock",
         SubTitle = "Lock this computer",
         Score = 20,
         IcoPath = "Images\\lock.png",
         Action = (c) => LockWorkStation()
     });
     availableResults.Add(new Result
     {
         Title = "Exit",
         SubTitle = "Close this app",
         Score = 110,
         IcoPath = "Images\\app.png",
         Action = (c) => context.CloseApp()
     });
 }
Example #9
0
        public void Init(PluginInitContext context)
        {
            this.context = context;
            controlPanelItems = ControlPanelList.Create(48);
            iconFolder = Path.Combine(context.CurrentPluginMetadata.PluginDirectory, @"Images\ControlPanelIcons\");
            fileType = ".bmp";

            if (!Directory.Exists(iconFolder))
            {
                Directory.CreateDirectory(iconFolder);
            }

            foreach (ControlPanelItem item in controlPanelItems)
            {
                if (!File.Exists(iconFolder + item.GUID + fileType) && item.Icon != null)
                {
                    item.Icon.ToBitmap().Save(iconFolder + item.GUID + fileType);
                }
            }

            Task.Run(() =>
            {
                var characters = controlPanelItems.Select(i => i.LocalizedString)
                    .Concat(controlPanelItems.Select(i => i.InfoTip));

                Parallel.ForEach(characters, c =>
                {
                    if (!string.IsNullOrWhiteSpace(c) && Alphabet.ContainsChinese(c))
                    {
                        Alphabet.PinyinComination(c);
                    }
                });
            });
        }
Example #10
0
        public void Init(PluginInitContext context)
        {
            this.Context = context;

            if (WebSearchStorage.Instance.WebSearches == null)
                WebSearchStorage.Instance.WebSearches = WebSearchStorage.Instance.LoadDefaultWebSearches();
        }
Example #11
0
        public WebSearchesSetting(PluginInitContext context)
        {
            this.context = context;

            InitializeComponent();

            Loaded += Setting_Loaded;
        }
Example #12
0
 public void Init( PluginInitContext context )
 {
     if ( !SimpleIoc.Default.IsRegistered<IMessageService>() )
     {
         SimpleIoc.Default.Register<IMessageService>( () => new MessageService() );
     }
     initContext = context;
 }
Example #13
0
        public JrnlService(SettingElements settings, PluginInitContext context)
        {
            if (settings == null)
                throw new ArgumentNullException("settings", "settings is null.");
            if (context == null)
                throw new ArgumentNullException("context", "context is null.");

            _settings = settings;
        }
Example #14
0
        public void Init(PluginInitContext context)
        {
            this.context = context;
            PluginDirectory = context.CurrentPluginMetadata.PluginDirectory;

            weibo = new Weibo();
            keepLoginTimer = new System.Threading.Timer(new TimerCallback(this.KeepLoginCallBack), null, Timeout.Infinite, Timeout.Infinite);

        }
Example #15
0
 public void Init( PluginInitContext context )
 {
     if ( !SimpleIoc.Default.IsRegistered<IMessageService>() )
     {
         SimpleIoc.Default.Register<IMessageService>( () => new MessageService() );
     }
     initContext = context;
     commands = RunnerConfiguration.GetCommands();
 }
Example #16
0
        protected override void InitInternal(PluginInitContext context)
        {
            this.context = context;

            if (UserSettingStorage.Instance.FolderLinks == null) {
                UserSettingStorage.Instance.FolderLinks = new List<FolderLink>();
                UserSettingStorage.Instance.Save();
            }
        }
Example #17
0
        protected override void InitInternal(PluginInitContext context)
        {
            indexDirectory.Add(Environment.GetFolderPath(Environment.SpecialFolder.Programs));

            StringBuilder commonStartMenuPath = new StringBuilder(560);
            SHGetSpecialFolderPath(IntPtr.Zero, commonStartMenuPath, CSIDL_COMMON_PROGRAMS, false);
            indexDirectory.Add(commonStartMenuPath.ToString());

            GetAppFromStartMenu();
        }
Example #18
0
        public void Init(PluginInitContext context)
        {
            if (context == null)
                throw new ArgumentNullException("context", "context is null.");

            _context = context;
            _settings = JsonConvert.DeserializeObject<SettingElements>(
                File.ReadAllText(Path.Combine(context.CurrentPluginMetadata.PluginDirectory, "setting.json")));
            CustomResult.DefaultIcoPath = context.CurrentPluginMetadata.IcoPath;
        }
Example #19
0
 public void Init(PluginInitContext context)
 {
     this.context = context;
     this.context.API.ResultItemDropEvent += API_ResultItemDropEvent;
     Stopwatch.Debug("Preload programs", () =>
     {
         programs = ProgramCacheStorage.Instance.Programs;
     });
     Log.Info($"Preload {programs.Count} programs from cache");
     Stopwatch.Debug("Program Index", IndexPrograms);
 }
Example #20
0
 protected override void InitInternal(PluginInitContext context)
 {
     this.context = context;
     this.context.API.BackKeyDownEvent += ApiBackKeyDownEvent;
     InitialDriverList();
     if (UserSettingStorage.Instance.FolderLinks == null)
     {
         UserSettingStorage.Instance.FolderLinks = new List<FolderLink>();
         UserSettingStorage.Instance.Save();
     }
 }
Example #21
0
        public void Init(PluginInitContext context)
        {
            this.context = context;
            ContextMenuStorage.Instance.API = context.API;

            LoadLibrary(Path.Combine(
                Path.Combine(context.CurrentPluginMetadata.PluginDirectory, (IntPtr.Size == 4) ? "x86" : "x64"),
                "Everything.dll"
            ));

            StartEverything();
        }
Example #22
0
 public void Init(PluginInitContext context)
 {
     this.context = context;
     this.context.API.BackKeyDownEvent += ApiBackKeyDownEvent;
     this.context.API.ResultItemDropEvent += API_ResultItemDropEvent;
     InitialDriverList();
     if (FolderStorage.Instance.FolderLinks == null)
     {
         FolderStorage.Instance.FolderLinks = new List<FolderLink>();
         FolderStorage.Instance.Save();
     }
 }
Example #23
0
        public static ISuggestionSource GetSuggestionSource(string name,PluginInitContext context)
        {
            switch (name.ToLower())
            {
                case "google":
                    return new Google(context.Proxy);

                case "baidu":
                    return new Baidu(context.Proxy);

                default:
                    return null;
            }
        }
        public void Init(PluginInitContext context)
        {
            _context = context;

            // initialize data, passing it the plugin directory
            Task.Run(() => _api = new SpotifyApi(_context.CurrentPluginMetadata.PluginDirectory));

            _terms.Add("artist", SearchArtist);
            _terms.Add("album", SearchAlbum);
            _terms.Add("track", SearchTrack);
            _terms.Add("next", PlayNext);
            _terms.Add("pause", Pause);
            _terms.Add("play", Play);
            _terms.Add("mute", ToggleMute);
        }
Example #25
0
File: Main.cs Project: danisein/Wox
        public void Init(PluginInitContext context)
        {
            _context = context;
            _storage = new PluginJsonStorage<Settings>();
            _settings = _storage.Load();

            var pluginDirectory = context.CurrentPluginMetadata.PluginDirectory;
            const string sdk = "EverythingSDK";
            var bundledSDKDirectory = Path.Combine(pluginDirectory, sdk, CpuType());
            var sdkDirectory = Path.Combine(_storage.DirectoryPath, sdk, CpuType());
            Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory);

            var sdkPath = Path.Combine(sdkDirectory, DLL);
            LoadLibrary(sdkPath);
        }
Example #26
0
        public void Init(PluginInitContext context)
        {
            this.context = context;
            this.context.API.BackKeyDownEvent += ApiBackKeyDownEvent;

            if (driveNames == null)
            {
                driveNames = DriveInfo.GetDrives().Select(d => d.Name.ToLower()).ToList();
            }

            if (FolderStorage.Instance.FolderLinks == null)
            {
                FolderStorage.Instance.FolderLinks = new List<FolderLink>();
                FolderStorage.Instance.Save();
            }
        }
Example #27
0
        public void Init(PluginInitContext context)
        {
            this.context = context;

            // Cache all bookmarks
            var chromeBookmarks = new ChromeBookmarks();
            var mozBookmarks = new FirefoxBookmarks();

            //TODO: Let the user select which browser's bookmarks are displayed
            // Add Firefox bookmarks
            cachedBookmarks.AddRange(mozBookmarks.GetBookmarks());
            // Add Chrome bookmarks
            cachedBookmarks.AddRange(chromeBookmarks.GetBookmarks());

            cachedBookmarks = cachedBookmarks.Distinct().ToList();
        }
Example #28
0
        // инициализация
        public void Init(PluginInitContext context)
        {
            // получение ссылки RSS

            var line = File.ReadAllLines(Directory.GetCurrentDirectory() + @"\Plugins\Wox.Plugin.Raindrop\url.txt").First();
            if (line != null)
            {
                _url = line;
            }
            else
            {
                return;
            }

            // скачиваем rss файл
            new WebClient().DownloadFile(_url, _filename);
        }
Example #29
0
File: Main.cs Project: pluto92/Wox
        public void Init(PluginInitContext context)
        {
            //todo:move to common place
            var otherCompanyDlls = new DirectoryInfo(context.PluginMetadata.PluginDirecotry).GetFiles("*.dll");
            AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
                {
                    var dll = otherCompanyDlls.FirstOrDefault(fi =>
                        {
                            try
                            {
                                Assembly assembly = Assembly.LoadFile(fi.FullName);
                                return assembly.FullName == args.Name;
                            }
                            catch
                            {
                                return false;
                            }
                        });
                    if (dll == null)
                    {
                        return null;
                    }

                    return Assembly.LoadFile(dll.FullName);
                };

            docsetBasePath = context.PluginMetadata.PluginDirecotry + @"Docset";
            if (!Directory.Exists(docsetBasePath))
                Directory.CreateDirectory(docsetBasePath);

            foreach (string path in Directory.GetDirectories(docsetBasePath))
            {
                string name = path.Substring(path.LastIndexOf('\\') + 1);
                string dbPath = path + @"\Contents\Resources\docSet.dsidx";
                string dbType = CheckTableExists("searchIndex", dbPath) ? "DASH" : "ZDASH";
                docs.Add(new Doc
                {
                    Name = name,
                    DBPath = dbPath,
                    DBType = dbType,
                    IconPath = TryGetIcon(name, path)
                });
            }
        }
        public SettingsForm(PluginInitContext context, SettingElements settings, SettingService service)
        {
            if (service == null)
                throw new ArgumentNullException("service", "service is null.");
            if (context == null)
                throw new ArgumentNullException("context", "context is null.");
            if (settings == null)
                throw new ArgumentNullException("settings", "settings is null.");

            _settings = settings;
            _service = service;
            _context = context;

            InitializeComponent();

            _settings.PropertyChanged += (sender, e) => _service.SaveSettings(context, settings);

            DataContext = _settings;
        }
Example #31
0
 public void Init(PluginInitContext context)
 {
     this._context              = context;
     _context.API.ThemeChanged += OnThemeChanged;
     UpdateIconPath(_context.API.GetCurrentTheme());
 }
Example #32
0
 public void Init(PluginInitContext context)
 {
     Client = new WebClient();
 }
Example #33
0
 public void Init(PluginInitContext context)
 {
     _context = context;
     PrepareFileCache();
 }
Example #34
0
 public void Init(PluginInitContext context)
 {
     this.context = context;
     ClipboardMonitor.OnClipboardChange += ClipboardMonitor_OnClipboardChange;
     ClipboardMonitor.Start();
 }
Example #35
0
 public ContextMenuLoader(PluginInitContext context)
 {
     _context = context;
 }
Example #36
0
 public void Init(PluginInitContext context)
 {
 }
 public DirectoryInfoSearch(PluginInitContext context)
 {
     resultManager = new ResultManager(context);
 }
 public ContextMenu(PluginInitContext context, Settings settings)
 {
     Context  = context;
     Settings = settings;
 }
 public AlarmDeleteCommand(PluginInitContext context, CommandHandlerBase parent) : base(context, parent)
 {
 }
Example #40
0
 public void Init(PluginInitContext context)
 {
     this.context = context;
     _settings    = context.API.LoadSettingJsonStorage <Settings>();
     context.API.RegisterGlobalKeyboardCallback(API_GlobalKeyboardEvent);
 }
Example #41
0
        public void Init(PluginInitContext context)
        {
            _context  = context;
            _settings = context.API.LoadSettingJsonStorage <Settings>();
            SortOptionTranlationHelper.API = context.API;

            if (_settings.MaxSearchCount <= 0)
            {
                _settings.MaxSearchCount = Settings.DefaultMaxSearchCount;
            }

            if (!_settings.EverythingInstalledPath.FileExists())
            {
                var installedLocation = Utilities.GetInstalledPath();

                if (string.IsNullOrEmpty(installedLocation) &&
                    System.Windows.Forms.MessageBox.Show(
                        string.Format(context.API.GetTranslation("flowlauncher_plugin_everything_installing_select"), Environment.NewLine),
                        context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"),
                        System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    // Solves single thread apartment (STA) mode requirement error when using OpenFileDialog
                    Thread t = new Thread(() =>
                    {
                        var dlg = new System.Windows.Forms.OpenFileDialog
                        {
                            InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
                        };

                        var result = dlg.ShowDialog();
                        if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrEmpty(dlg.FileName))
                        {
                            installedLocation = dlg.FileName;
                        }
                    });

                    // Run your code from a thread that joins the STA Thread
                    t.SetApartmentState(ApartmentState.STA);
                    t.Start();
                    t.Join();
                }

                if (string.IsNullOrEmpty(installedLocation))
                {
                    Task.Run(async delegate
                    {
                        context.API.ShowMsg(context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"),
                                            context.API.GetTranslation("flowlauncher_plugin_everything_installing_subtitle"), "", useMainWindowAsOwner: false);

                        await DroplexPackage.Drop(App.Everything1_4_1_1009).ConfigureAwait(false);

                        context.API.ShowMsg(context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"),
                                            context.API.GetTranslation("flowlauncher_plugin_everything_installationsuccess_subtitle"), "", useMainWindowAsOwner: false);

                        _settings.EverythingInstalledPath = "C:\\Program Files\\Everything\\Everything.exe";

                        FilesFolders.OpenPath(_settings.EverythingInstalledPath);
                    }).ContinueWith(t =>
                    {
                        _context.API.LogException("Everything.Main", $"Failed to install Everything service", t.Exception.InnerException, "DroplexPackage.Drop");
                        MessageBox.Show(context.API.GetTranslation("flowlauncher_plugin_everything_installationfailed_subtitle"),
                                        context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"));
                    }, TaskContinuationOptions.OnlyOnFaulted);
                }
                else
                {
                    _settings.EverythingInstalledPath = installedLocation;
                }
            }

            var          pluginDirectory     = context.CurrentPluginMetadata.PluginDirectory;
            const string sdk                 = "EverythingSDK";
            var          bundledSdkDirectory = Path.Combine(pluginDirectory, sdk, CpuType());

            var sdkPath = Path.Combine(bundledSdkDirectory, DLL);

            _api.Load(sdkPath);
        }
Example #42
0
 public void Init(PluginInitContext context)
 {
     this._context = context;
     context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
 }
Example #43
0
 protected override void InitInternal(PluginInitContext context)
 {
     allPlugins  = context.Plugins;
     changeQuery = context.ChangeQuery;
 }
Example #44
0
 public void Init(PluginInitContext ctx)
 {
     context = ctx;
 }
Example #45
0
 public ContextMenu(PluginInitContext context, Settings settings, SettingsViewModel vm)
 {
     Context   = context;
     Settings  = settings;
     ViewModel = vm;
 }
Example #46
0
 public void Init(PluginInitContext context)
 {
     this.context = context;
     S.CoreStuff.Initialize();
 }
Example #47
0
        public void Init(PluginInitContext context)
        {
            _context = context;

            _executor = UserQueryExecutorFactory.Create(context);
        }
Example #48
0
 public void Init(PluginInitContext context)
 {
     this.context = context;
 }
 public void Init(PluginInitContext context)
 {
     browser      = GetDefaultBrowserPath();
     currentPath  = context.CurrentPluginMetadata.PluginDirecotry;
     allBookmarks = new ReadBookmarks().GetBookmarks(currentPath);
 }
Example #50
0
 public void Init(PluginInitContext context)
 {
     _context = context;
 }
Example #51
0
 public void Init(PluginInitContext context)
 {
     Startup.Initialize(new PluginContext(context));
     _engine = Startup.Resolve <IEngine>();
 }
Example #52
0
 public ContextMenu(PluginInitContext context)
 {
     Context = context;
 }
Example #53
0
 public void InitSync(PluginInitContext context)
 {
     _context = context;
     loadSettings();
     IndexPrograms();
 }
Example #54
0
 public void Init(PluginInitContext context)
 {
     mGlosbeHelper = new GlosbeHelper();
 }
Example #55
0
        private readonly string equalCheckPattern    = @"(\d+(\.\d{1,2})?)?\s([A-Za-z]{3})\s([=])\s([A-Za-z]{3})";    // 10 usd = vnd

        public void Init(PluginInitContext context)
        {
            _context = context;
            _utils   = new Utils();
        }
Example #56
0
File: Sys.cs Project: shuiyibu/Wox
 public void Init(PluginInitContext context)
 {
     this.context = context;
     LoadCommands();
 }
Example #57
0
 protected override void InitInternal(PluginInitContext context)
 {
     this.context = context;
     LoadPrograms();
 }
Example #58
0
 public void Init(PluginInitContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _context.API.ThemeChanged += OnThemeChanged;
     UpdateUWPIconPath(_context.API.GetCurrentTheme());
 }
Example #59
0
 public void Init(PluginInitContext context)
 {
     this.context = context;
     random       = new System.Random();
 }
Example #60
0
 public void Init(PluginInitContext context)
 {
     _context           = context;
     _contextMenuLoader = new ContextMenuLoader(context);
     InitialDriverList();
 }