예제 #1
0
        public WallpaperMain()
        {
            icon = new NotifyIcon
            {
                Text = "WallQuotePaper",
                Icon = Properties.Resources.TrayIcon,
                Visible = true
            };
            icon.ContextMenuStrip = MakeMenu();

            Application.ApplicationExit += Application_ApplicationExit;
            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
            SystemEvents.PowerModeChanged += OnPowerChange;

            data = new WallpaperData();
            random = new Random();
            maker = new WallpaperMaker(this, data);

            minuteTimer = new Timer();
            minuteTimer.Tick += minuteTimerTick;
            minuteTimer.Interval = 1000 * 60;
            minuteTimer.Enabled = true;

            refreshTimer = new Timer();
            refreshTimer.Tick += refreshTimerTick;
            refreshTimer.Interval = 1000 * 60 * 15;
            refreshTimer.Enabled = true;

            UpdateIcon();
            NextWallpaper();
        }
예제 #2
0
        public WallpaperMaker(WallpaperMain wallQuotePaper, WallpaperData wallpaperData)
        {
            this.wallQuotePaper = wallQuotePaper;
            data = wallpaperData;

            //Settings
            quoteFont = new Font("DejaVu Sans Mono", 40);
            //(itemFont is set in Make)
            titleFont = new Font("DejaVu Sans Mono", 21);
            fill = Brushes.White;
            outline = Brushes.Black;
            outlineSize = 1;
            quoteOutlineSize = 2;

            //Get the screen dimensions of the main screen and make the corresponding bitmap
            Rectangle screenSize = Screen.PrimaryScreen.Bounds;
            bitmap = new Bitmap(screenSize.Width, screenSize.Height);
            gr = Graphics.FromImage(bitmap);

            //Setup for text
            gr.TextRenderingHint = TextRenderingHint.AntiAlias;
            gr.SmoothingMode = SmoothingMode.AntiAlias;
            gr.InterpolationMode = InterpolationMode.High;
            //gr.SmoothingMode = SmoothingMode.HighQuality;
            gr.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
            gr.CompositingQuality = CompositingQuality.HighQuality;
        }
예제 #3
0
        public WallpaperDataEdit(WallpaperMain main, WallpaperData data)
        {
            this.main = main;
            this.data = data;

            Text = "Edit items";
            ClientSize = new Size(10 + 310 * (2 + data.numberOfTodos), 574);

            //TODO: make todo, deadlines and appointments equal
            todoTitles = new TextBox[data.numberOfTodos];
            todoBodies = new TextBox[data.numberOfTodos];
            for (int i = 0; i < data.numberOfTodos; i++)
            {
                todoTitles[i] = new TextBox
                {
                    Size = new Size(300, 22),
                    Text = data.todoTitles[i],
                    Location = new Point(10 + 310*i, 10)
                };
                Controls.Add(todoTitles[i]);
                todoBodies[i] = new TextBox
                {
                    Multiline = true,
                    Size = new Size(300, 500),
                    Text = data.GetTodoBlock(i),
                    Location = new Point(10 + 310 * i, 37)
                };
                Controls.Add(todoBodies[i]);
            }

            Label deadlinesTitle = new Label
            {
                Location = new Point(10 + 310*data.numberOfTodos, 10),
                Text = "Deadlines"
            };
            Controls.Add(deadlinesTitle);

            Label appointmentsTitle = new Label
            {
                Location = new Point(10 + 310*(data.numberOfTodos + 1), 10),
                Text = "Appointments"
            };
            Controls.Add(appointmentsTitle);

            //TODO: Change from textbox to something better?
            deadlinesBody = new TextBox
            {
                Multiline = true,
                Text = data.GetDeadlineEditBlock(),
                Size = new Size(300, 500),
                Location = new Point(10 + 310*data.numberOfTodos, 37)
            };
            Controls.Add(deadlinesBody);

            appointmentsBody = new TextBox
            {
                Multiline = true,
                Text = data.GetAppointmentEditBlock(),
                Size = new Size(300, 500),
                Location = new Point(10 + 310*(data.numberOfTodos + 1), 37)
            };
            Controls.Add(appointmentsBody);

            Button saveButton = new Button {Text = "Save"};
            saveButton.Click += SaveButton_Click;
            saveButton.Size = new Size(100, 22);
            saveButton.Location = new Point(ClientSize.Width - 230, ClientSize.Height - 32);
            Controls.Add(saveButton);

            Button saveExitButton = new Button { Text = "Save and exit" };
            saveExitButton.Click += SaveExitButton_Click;
            saveExitButton.Size = new Size(100, 22);
            saveExitButton.Location = new Point(ClientSize.Width - 110, ClientSize.Height - 32);
            Controls.Add(saveExitButton);

            Show();
        }