Esempio n. 1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            switch (((Button)sender).Name)
            {
            case "btnNextLocations":
                //update source paths
                myMedia.AddLocations(sourcePaths, true);

                if (myMedia.UpdatedLocations)    //the locations updated so check for new media files
                {
                    MediaLibrary_Listview mediaLibrary = (MediaLibrary_Listview)this.Owner;
                    mediaLibrary.UpdateMedia();
                }
                break;
            }

            tabControl1.SelectedIndex = tabControl1.SelectedIndex + 1;
        }
Esempio n. 2
0
        public SCTV()
        {
            //try
            //{
            //    if (!SCTVActivation.isActivated())
            //    {
            //        MessageBox.Show("This product needs to be activated.  Call Support");

            //        this.Close();
            //        return;
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Tools.WriteToFile(Tools.errorFile, ex.Source +" : "+ ex.Message);
            //}

            try
            {
                InitializeComponent();

                bool.TryParse(System.Configuration.ConfigurationManager.AppSettings["Speech.Enabled"], out speechEnabled);
                defaultPathToSaveTo = System.Configuration.ConfigurationManager.AppSettings["Media.DefaultPathToSaveTo"];

                if (defaultPathToSaveTo.Trim().Length == 0)
                {
                    //make sure directory exists
                    if (!Directory.Exists(Application.StartupPath + "\\DVD\\"))
                    {
                        Directory.CreateDirectory(Application.StartupPath + "\\DVD\\");
                    }

                    defaultPathToSaveTo = Application.StartupPath + "\\DVD\\";
                }

                try
                {
                    //watch for inserted dvd/cd's
                    deviceMonitor = new DeviceVolumeMonitor(this.Handle);
                    deviceMonitor.OnVolumeInserted += new DeviceVolumeAction(VolumeInserted);
                    deviceMonitor.OnVolumeRemoved  += new DeviceVolumeAction(VolumeRemoved);
                }
                catch (Exception ex)
                {
                    Tools.WriteToFile(Tools.errorFile, ex.Source + " : " + ex.Message);
                }

                if (speechEnabled)
                {
                    try
                    {
                        //listen for voice commands
                        speechListener = new SpeechRecognition("xmlmain.xml");
                        speechListener.executeCommand += new SpeechRecognition.HeardCommand(speechListener_executeCommand);
                        speechListener.Show();
                    }
                    catch (Exception ex)
                    {
                        Tools.WriteToFile(Tools.errorFile, ex.Source + " : " + ex.Message);
                    }
                }

                //volume control
                speakers = new Speakers();

                //mouse hooks
                //private static LowLevelMouseProc _proc = HookCallback;
                //private static IntPtr _hookID = IntPtr.Zero;
                //private delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam);
                //private const int WH_MOUSE_LL = 14;

                //mouse hooks
                //private enum MouseMessages
                //{
                //    WM_LBUTTONDOWN = 0x0201,
                //    WM_LBUTTONUP = 0x0202,
                //    WM_MOUSEMOVE = 0x0200,
                //    WM_MOUSEWHEEL = 0x020A,
                //    WM_RBUTTONDOWN = 0x0204,
                //    WM_RBUTTONUP = 0x0205
                //}

                //display mediaLibrary
                if (mediaLibrary_Datalist == null)//create mediaLibrary
                {
                    //speechListener.loadGrammarFile("xmlmediaLibrary.xml");

                    mediaLibrary_Datalist = null;
                    mediaLibrary_Datalist = new MediaLibrary_Listview(myMedia);
                    mediaLibrary_Datalist.SpeechListener = speechListener;
                    //myMediaLibrary.KeyUp += new System.Windows.Forms.KeyEventHandler(KeyUpHandler);
                    mediaLibrary_Datalist.ShowDialog(this);
                }
                else
                {
                    mediaLibrary_Datalist.ShowDialog(this);
                }

                SCTVObjects.SplashScreenNew.CloseForm();

                this.Close();
            }
            catch (Exception ex)
            {
                Tools.WriteToFile(Tools.errorFile, ex.Source + " : " + ex.Message + " || " + ex.StackTrace);
                MessageBox.Show("An error has occurred" + Environment.NewLine + "Error: " + ex.Source + ": " + ex.Message);
            }
        }