Beispiel #1
0
        public GideonBase()
        {
            InitializeComponent();
            //  var image = new BitmapImage();

            //   ImageBehavior.SetAnimatedSource(BgImage, (ImageSource) new ImageSourceConverter().ConvertFromString(GideonPath.Background));
            GrammarTableObj = new Hashtable();
            RemainderObj    = new RemainderUI();
            RemainderUI.ReadFromFile();
            GalleryObj = new GalleryUI();
            aobj       = new Alaram();
            try
            {
                EngineObj = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-IN"));
                EngineObj.SetInputToDefaultAudioDevice();
                SynObj = new SpeechSynthesizer {
                    Volume = 100
                };
                SynObj.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Teen, 18, System.Globalization.CultureInfo.CurrentUICulture);
                LoadGrammar(Modules.Gideon, Grammars.GideonGrammar);
                LoadGrammar(Modules.PcInfo, Grammars.PcInfoGrammar);
                EngineObj.RecognizeAsync(RecognizeMode.Multiple);
                EngineObj.SpeechRecognized += new EventHandler <SpeechRecognizedEventArgs>(Engine_SpeechRecognized);


                MHObj = new ModulesHandler();
                MHObj.OpenModule(Modules.Remainder);

                dispatcherTimer          = new DispatcherTimer();
                dispatcherTimer.Tick    += new EventHandler(alaramTimer);
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);


                Timer          = new DispatcherTimer();
                Timer.Tick    += new EventHandler(showTime);
                Timer.Interval = new TimeSpan(0, 0, 1);
                Timer.Start();

                date.Content         = DateTime.Now.Date.ToShortDateString();
                DateTimeGrid.ToolTip = DateTime.Now.ToString("F");
                setBackgrounds();
                WeatherUpdate();
                NewsUpdate();
                SetValues();
                quotes = Motivational_Quotes.FetchQuotes();
                Greet();
            }
            catch (System.Net.WebException)
            {
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            Alaram a1 = new Alaram();

            bool tryAgain = false;

            while (!tryAgain)
            {
                DateTime timeNow = DateTime.UtcNow.ToLocalTime();

                Console.WriteLine("Current time => {0}:{1}:{2}", timeNow.TimeOfDay.Hours.ToString(), timeNow.TimeOfDay.Minutes.ToString(), timeNow.TimeOfDay.Seconds.ToString());


                DateTime alaramTime = a1.getAlaramTime(timeNow);


                if (timeNow.CompareTo(alaramTime) == 1)
                {
                    Console.Clear();
                    Console.WriteLine("Cant ring alarm for past try again");
                    continue;
                }


                Console.WriteLine("Alarm will ring at => {0}h:{1}m:{2}s", alaramTime.TimeOfDay.Hours.ToString(), alaramTime.TimeOfDay.Minutes.ToString(), alaramTime.TimeOfDay.Seconds.ToString());
                //Console.WriteLine('\n');



                while (true)
                {
                    timeNow = DateTime.UtcNow.ToLocalTime();

                    if (timeNow.Hour == alaramTime.Hour && timeNow.Minute == alaramTime.Minute)
                    {
                        Console.Clear();
                        Console.WriteLine("Time now: {0}", timeNow);
                        a1.ringBell(28);
                        break;
                    }
                }


                Console.Write("To set alaram again press Y:> ");
                char descision = Console.ReadKey(true).KeyChar;


                Console.WriteLine(descision);

                if (descision == 'y' || descision == 'Y')
                {
                    continue;
                }
                else
                {
                    tryAgain = true;
                }
            }



            Console.WriteLine("Bye");
            a1.pauseTime(10000);
        }