Beispiel #1
0
 void OnApplicationQuit()
 {
     _mWaitForExit = false;
     ChromaAnimationAPI.StopAll();
     ChromaAnimationAPI.CloseAll();
     ChromaAnimationAPI.Uninit();
 }
        static void Main(string[] args)
        {
            SampleApp sampleApp = new SampleApp();

            sampleApp.Start();

            if (sampleApp.GetInitResult() == RazerErrors.RZRESULT_SUCCESS)
            {
                int selectedIndex = 1;

                sampleApp.ExecuteItem(selectedIndex);

                DateTime inputTimer = DateTime.MinValue;

                while (true)
                {
                    if (inputTimer < DateTime.Now)
                    {
                        Console.Clear();
                        PrintLegend(sampleApp, selectedIndex);
                        inputTimer = DateTime.Now + TimeSpan.FromMilliseconds(100);
                    }
                    ConsoleKeyInfo keyInfo = Console.ReadKey();

                    if (keyInfo.Key == ConsoleKey.UpArrow)
                    {
                        if (selectedIndex > 1)
                        {
                            --selectedIndex;
                        }
                    }
                    else if (keyInfo.Key == ConsoleKey.DownArrow)
                    {
                        if (selectedIndex < MAX_ITEMS)
                        {
                            ++selectedIndex;
                        }
                    }
                    else if (keyInfo.Key == ConsoleKey.Escape)
                    {
                        break;
                    }
                    else if (keyInfo.Key == ConsoleKey.Enter)
                    {
                        sampleApp.ExecuteItem(selectedIndex);
                    }
                    Thread.Sleep(1);
                }

                ChromaAnimationAPI.StopAll();
                ChromaAnimationAPI.CloseAll();
                sampleApp.OnApplicationQuit();
            }

            Console.WriteLine("{0}", "C# Chroma Sample App [EXIT]");
        }
 void OnApplicationQuit()
 {
     _mWaitForExit = false;
     if (null != _mThread)
     {
         _mThread.Join();
         _mThread = null;
     }
     ChromaAnimationAPI.StopAll();
     ChromaAnimationAPI.CloseAll();
     ChromaAnimationAPI.Uninit();
 }