Example #1
0
        private static void HandleFirstRun(Wallpaper wall)
        {
            if (!File.Exists(Program.UserDir + "CustomWallpapers\\static.jpg"))// Save original to use as static wallpaper
                wall.SaveOriginalWallpaper();

            if (Properties.Settings.Default.FirstRun)
            {
                // Start with windows
                RegistryKey add = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                add.SetValue("Weather Wallpaper", "\"" + Application.ExecutablePath + "\"");

                // Set as saved
                Properties.Settings.Default.FirstRun = false;
                Properties.Settings.Default.Save();
            }
        }
Example #2
0
        public SettingsForm(Wallpaper _wall, bool minimized)
        {
            InitializeComponent();
            wall = _wall;

            if (minimized)
            {
                WindowState = FormWindowState.Minimized;
                ShowInTaskbar = false;
            }

            // Enable dragdrop on pictureboxes
            ((Control)pictureBox_Sunny).AllowDrop = true;
            ((Control)pictureBox_PartlyCloudy).AllowDrop = true;
            ((Control)pictureBox_Cloudy).AllowDrop = true;
            ((Control)pictureBox_Clear).AllowDrop = true;
            ((Control)pictureBox_Rain).AllowDrop = true;
            ((Control)pictureBox_Thunderstorm).AllowDrop = true;
            ((Control)pictureBox_Snow).AllowDrop = true;
            ((Control)pictureBox_Static).AllowDrop = true;

            // Prepare multiscreen
            var screens = Multiscreen.GetScreenInfo();
            foreach (KeyValuePair<string, bool> screen in screens)
                screenListBox.Items.Add(screen.Key, screen.Value);

            // set context menu
            ContextMenu iconMenu = new ContextMenu();
            MenuItem openItem = new MenuItem("Open");
            openItem.Click += IconMenuOpen;
            iconMenu.MenuItems.Add(openItem);
            MenuItem exitItem = new MenuItem("Exit");
            exitItem.Click += IconMenuExit;
            iconMenu.MenuItems.Add(exitItem);
            notifyIcon.ContextMenu = iconMenu;
        }
Example #3
0
        private static void Start(string[] args)
        {
            // Close any running process of Weather Wallpaper
            CloseOtherRunning();

            // Start Wallpaper
            Wallpaper wall = new Wallpaper();

            // Prepare for first use
            HandleFirstRun(wall);

            // Start application
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Background-start some forms
            previewForm = new PreviewForm();

            // Handle args
            bool minimized = false;
            foreach (string arg in args)
            {
                if (arg == "minimized")
                    minimized = true;
            }

            Application.Run(settingsForm = new SettingsForm(wall, minimized));
        }