Esempio n. 1
0
        public App()
        {
            Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
            ResourceDictionary myresourcedictionary_Generic = new ResourceDictionary();

            myresourcedictionary_Generic.Source = new Uri("/ilrLearnerEntry;component/StandardResourceDictionary.xaml", UriKind.RelativeOrAbsolute);
            this.Resources.MergedDictionaries.Add(myresourcedictionary_Generic);

            string Path = System.Reflection.Assembly.GetExecutingAssembly().Location;

            System.IO.FileInfo fi = new System.IO.FileInfo(Path);
            DataFolder   = fi.DirectoryName;
            ExportFolder = fi.DirectoryName;


            string[] args = Environment.GetCommandLineArgs();
            foreach (string arg in args)
            {
                if ((arg.ToUpper() == "NOCHECKONSTART") || (arg.ToUpper() == "/NOCHECKONSTART"))
                {
                    NoCheckOnStart = true;
                    break;
                }
            }
            if (!NoCheckOnStart)
            {
                if (!mutex.WaitOne(TimeSpan.FromSeconds(0.01), false))
                {
                    MessageBox.Show(String.Format("You re already running a version of this application.{0} This version will close.", Environment.NewLine)
                                    , "Alreay Running a version of Application "
                                    , MessageBoxButton.OK
                                    , MessageBoxImage.Asterisk
                                    , MessageBoxResult.OK);
                    // Already running.
                    Application.Current.Shutdown();
                    return;
                }
            }
            GC.Collect();

            Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose;
            ILRMessage = new ILR.Message(System.IO.Path.Combine(DataFolder, "internal.ilr"));
        }
Esempio n. 2
0
 private void SetupApplicationStuff()
 {
     Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose;
     ILRMessage = new ILR.Message(System.IO.Path.Combine(DataFolder, ApplicationInternalFilename));
 }
 private void SetupApplicationStuff()
 {
     Log("App", "SetupApplicationStuff", "Enable loging to File");
     Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose;
     ILRMessage = new ILR.Message(System.IO.Path.Combine(DataFolder, ApplicationInternalFilename), LogFileName);
 }