Esempio n. 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            WorkerThreadPool.Instance.InvokingThread = new WpfDispatcher(Dispatcher);
            History.Instance.AllowedThreadId         = Thread.CurrentThread.ManagedThreadId;

            ApplySkin(new Uri("/CoreControls;component/resources/BaseSkin.xaml", UriKind.Relative));

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(
                       "PureMp3.Resources.Texts.xml"))
            {
                LocalizationDatabase.Instance.Load(stream);
            }

            try
            {
                AppPreferences.Load(App.AppName);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.WriteLine(ex.StackTrace);
            }

            try
            {
                RecycleBin.Instance.RootDir = App.AppRecycleFolder;
                RecycleBin.Instance.DeleteContent();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.WriteLine(ex.StackTrace);
            }

            Doc = DocNode.Create <Document>();
            History.Instance.Root = Doc;

            try
            {
                keyboardListener.KeyDown += new RawKeyEventHandler(keyboardListener_KeyDown);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.WriteLine(ex.StackTrace);
            }
        }