예제 #1
0
        public ScrubberGUI(List<string> keywords)
        {
            this.keywords = keywords;
            settings = new SettingsGUI();

            InitializeComponent();
        }
예제 #2
0
파일: Program.cs 프로젝트: solbirn/Scrubber
        private static void Main(string[] args)
        {
            using (ShellLink shortcut = new ShellLink())
            {
                shortcut.Target = Application.ExecutablePath;
                shortcut.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
                shortcut.Arguments = "-s";
                shortcut.Description = "Settings GUI for Scrubber";
                shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;
                shortcut.Save(Environment.ExpandEnvironmentVariables("%appdata%") + "\\Microsoft\\Windows\\Start Menu\\Programs\\Scrubber\\Scrubber Settings.lnk");
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            SettingsGUI settings = new SettingsGUI();

            List<string> keywords = new List<string>(args);

            if (keywords.Count > 0)
            {
                if (keywords[0].StartsWith("-") || keywords[0].StartsWith("/"))
                {
                    if (keywords[0].Equals("-s") || keywords[0].Equals("--settings") || keywords[0].Equals("/s"))
                    {
                        Application.Run(settings);
                        Application.Exit();
                        return;
                    }
                    keywords.RemoveAt(0);
                }
            }

            foreach (string kw in settings.getKeywordsFromRaw())
            {
                if (!kw.Equals(""))
                    keywords.Add(kw);
            }

            if (keywords.Count != 0)
            {
                ScrubberGUI GUI = new ScrubberGUI(keywords);
                Application.Run(GUI);
            }
            else
            {
                Application.Run(settings);
                Thread t = new Thread(() => OpenApp(keywords));
                t.Start();
            }
        }