Ejemplo n.º 1
0
        private void MouseDraw(MainWindow main, Point p)
        {
            //randomize at some point?
            Shape shape = new Ellipse
            {
                Stroke          = SystemColors.WindowTextBrush,
                StrokeThickness = 0,
                Fill            = Utils.GetGradientBrush(Utils.GetRandomColor()),
                Width           = 50,
                Height          = 50
            };

            ellipsesQueue.Enqueue(shape);
            main.mouseDragCanvas.Children.Add(shape);
            Canvas.SetLeft(shape, p.X - 25);
            Canvas.SetTop(shape, p.Y - 25);

            if (Settings.Default.MouseDraw)
            {
                Win32Audio.PlayWavResourceYield("smallbumblebee.wav");
            }

            if (ellipsesQueue.Count > 30) //this is arbitrary
            {
                Shape shapeToRemove = ellipsesQueue.Dequeue();
                main.mouseDragCanvas.Children.Remove(shapeToRemove);
            }
        }
Ejemplo n.º 2
0
 public void MouseWheel(MainWindow main, MouseWheelEventArgs e)
 {
     if (e.Delta > 0)
     {
         Win32Audio.PlayWavResourceYield("rising.wav");
     }
     else
     {
         Win32Audio.PlayWavResourceYield("falling.wav");
     }
 }
Ejemplo n.º 3
0
        public void MouseDown(MainWindow main, MouseButtonEventArgs e)
        {
            if (isDrawing || Settings.Default.MouseDraw)
            {
                return;
            }

            // Create a new Ellipse object and add it to canvas.
            Point ptCenter = e.GetPosition(main.mouseCursorCanvas);

            MouseDraw(main, ptCenter);
            isDrawing = true;
            main.CaptureMouse();

            Win32Audio.PlayWavResource("smallbumblebee.wav");
        }
Ejemplo n.º 4
0
 private void PlayLaughter()
 {
     Win32Audio.PlayWavResource(Utils.GetRandomSoundFile());
 }
Ejemplo n.º 5
0
        public void Launch()
        {
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 1);
            int Number = 0;

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                deployment = ApplicationDeployment.CurrentDeployment;
                deployment.UpdateCompleted         += new System.ComponentModel.AsyncCompletedEventHandler(deployment_UpdateCompleted);
                deployment.UpdateProgressChanged   += deployment_UpdateProgressChanged;
                deployment.CheckForUpdateCompleted += deployment_CheckForUpdateCompleted;
                try
                {
                    deployment.CheckForUpdateAsync();
                }
                catch (InvalidOperationException e)
                {
                    Debug.WriteLine(e.ToString());
                }
            }

            foreach (WinForms.Screen s in WinForms.Screen.AllScreens)
            {
                MainWindow m = new MainWindow(this)
                {
                    WindowStartupLocation = WindowStartupLocation.Manual,
                    Left               = s.WorkingArea.Left,
                    Top                = s.WorkingArea.Top,
                    Width              = s.WorkingArea.Width,
                    Height             = s.WorkingArea.Height,
                    WindowStyle        = WindowStyle.None,
                    ResizeMode         = ResizeMode.NoResize,
                    Topmost            = true,
                    AllowsTransparency = Settings.Default.TransparentBackground,
                    Background         = (Settings.Default.TransparentBackground ? new SolidColorBrush(Color.FromArgb(1, 0, 0, 0)) : Brushes.WhiteSmoke),
                    Name               = "Window" + Number++.ToString()
                };

                figuresUserControlQueue[m.Name] = new List <UserControl>();

                m.Show();
                m.MouseLeftButtonDown += HandleMouseLeftButtonDown;
                m.MouseWheel          += HandleMouseWheel;
                m.WindowState          = WindowState.Maximized;
                windows.Add(m);
            }

            //Only show the info label on the FIRST monitor.
            windows[0].infoLabel.Visibility = Visibility.Visible;

            //Startup sound
            Win32Audio.PlayWavResourceYield("EditedJackPlaysBabySmash.wav");

            string[] args = Environment.GetCommandLineArgs();
            string   ext  = System.IO.Path.GetExtension(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

            if (ApplicationDeployment.IsNetworkDeployed && (ApplicationDeployment.CurrentDeployment.IsFirstRun || ApplicationDeployment.CurrentDeployment.UpdatedVersion != ApplicationDeployment.CurrentDeployment.CurrentVersion))
            {
                //if someone made us a screensaver, then don't show the options dialog.
                if ((args != null && args[0] != "/s") && String.CompareOrdinal(ext, ".SCR") != 0)
                {
                    ShowOptionsDialog();
                }
            }
#if !false
            timer.Start();
#endif
        }