예제 #1
0
 public static FixedSizedQueue <App> LoadHistoryConfig(string path)
 {
     if (!Directory.Exists(path))
     {
         Directory.CreateDirectory(path);
     }
     if (!File.Exists($"{path}\\history.json"))
     {
         FixedSizedQueue <App> create = new FixedSizedQueue <App>();
         SaveLastStartedConfig(path, create);
         return(create);
     }
     return(JsonConvert.DeserializeObject <FixedSizedQueue <App> >(File.ReadAllText($"{path}\\history.json")));
 }
예제 #2
0
        public WIN()
        {
            InitializeComponent();
            ConfigPath           = $"{PropsPath}\\SmartWIN";
            this.lastStartedApps = ConfigLoader.LoadHistoryConfig(ConfigPath);
            this.Width           = SystemInformation.PrimaryMonitorSize.Width;
            this.MaximumSize     = this.MinimumSize = new Size(this.Width, 22);
            this.BackColor       = Theme.FormBackColor;
            this.Shown          += delegate
            {
                this.Hide();
                Process shellStart = new Process();
                shellStart.StartInfo.FileName = "explorer";
                shellStart.Start();
                WINFix.HideWinBtn();
            };

            //Spawn controls
            searchBox.Location  = new Point(50, 1);
            searchBox.Font      = Theme.TextFont;
            searchBox.ForeColor = Theme.TextColor;
            searchBox.BackColor = Theme.BackColor;
            for (int posX = 280; posX + 202 < this.Width - 30; posX += tileWidth)
            {
                Label temp = new Label();
                temp.Location  = new Point(posX, 0);
                temp.Size      = new Size(tileWidth, 25);
                temp.TextAlign = ContentAlignment.MiddleCenter;
                temp.Font      = Theme.TextFont;
                temp.BackColor = Theme.BackColor;
                temp.ForeColor = Theme.TextColor;
                this.Controls.Add(temp);
                dataControls.Add(temp);
            }
            ControlsCount = dataControls.Count;
            //Start KeyHook
            keyHook = new KeyHook(this);
            keyHook.LeftArrowEvent     += LeftArrClick;
            keyHook.RightArrowEvent    += RightArrClick;
            keyHook.EnterClickEvent    += EnterClick;
            keyHook.OpenCloseEvent     += ShowHideEvent;
            keyHook.KeyClickEvent      += KeyClick;
            keyHook.ShutdownClickEvent += ShutdownClick;

            //TODO: Finder by standard folders
            finders = new IFinder[] {
                new StartMenuHandler(ConfigPath, StartMenuPathes)
            };
        }
예제 #3
0
 public static void SaveLastStartedConfig(string path, FixedSizedQueue <App> config)
 {
     File.WriteAllText($"{path}\\history.json", JsonConvert.SerializeObject(config));
 }