Esempio n. 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            base.Initialize();

            GraphicsUpdateResolutionSettings();

            AudioHandler.Initialize();
            sceneHandler.Initialize(GraphicsDevice);
        }
Esempio n. 2
0
 // Runs before start
 private void Awake()
 {
     audioSource = GetComponent <AudioSource>();
     DontDestroyOnLoad(gameObject);
     if (!AudioHandler.Initialized)
     {
         AudioHandler.Initialize(audioSource);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 3
0
        public MainWindow()
        {
#if !DEBUG
            Hide();
#endif

            var    assembly     = Assembly.GetExecutingAssembly();
            string resourceName = "WPF_Soundboard.Resources.icon.ico";

            using Stream stream    = assembly.GetManifestResourceStream(resourceName);
            notifyIcon.Icon        = new Icon(stream);
            notifyIcon.Visible     = true;
            notifyIcon.MouseClick += NotifyIcon_MouseClick;

            notifyIcon.ContextMenuStrip = new ContextMenuStrip();
            var showItem = new ToolStripMenuItem("Show");
            showItem.Click += ShowItem_Click;
            var exitItem = new ToolStripMenuItem("Exit");
            exitItem.Click += ExitItem_Click;
            notifyIcon.ContextMenuStrip.Items.Add(showItem);
            notifyIcon.ContextMenuStrip.Items.Add(exitItem);


            InitializeComponent();

            try
            {
                AudioHandler.Initialize();
            }
            catch
            {
                try
                {
                    MessageBoxResult result = System.Windows.MessageBox.Show("Error while initializing Audio. Do you want to reset audio settings?",
                                                                             "Audio error in WPF-Soundboard",
                                                                             MessageBoxButton.YesNo,
                                                                             MessageBoxImage.Error);

                    if (result == MessageBoxResult.Yes)
                    {
                        AudioHandler.Config = AudioConfig.GetDefault();
                        AudioHandler.Initialize();
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (Exception e)
                {
                    System.Windows.MessageBox.Show(e.GetType() + ": " + e.Message + "\n--------\n" + e.StackTrace, "Audio error in WPF-Soundboard - Quitting", MessageBoxButton.OK, MessageBoxImage.Error);

                    closing            = true;
                    notifyIcon.Visible = false;
                    AudioHandler.Dispose();
                    System.Windows.Application.Current.Shutdown();
                    return;
                }
            }

            clipPages = Serializer.GetClipPages();
            clipPages.GlobalHotkeyList.OnHotkeyPressed += GlobalHotkeyList_OnHotkeyPressed;
            clipPages.OnStopHotkeyPressed += ClipPages_OnStopHotkeyPressed;

            if (clipPages.Count == 0)
            {
                clipPages.Add(new ClipPage(7, 5));
            }

            foreach (ClipPage page in clipPages)
            {
                page.OnChanged       += Page_OnChanged;
                page.OnHotkeyPressed += Page_OnHotkeyPressed;
            }

            currentPage = clipPages[0];
            BuildClipPage();
            UpdatePagesList();
        }
 void Start()
 {
     audioHandler.Initialize(1);
 }