Exemple #1
0
        public InformationAboutViewModel(IUnityContainer container, IDialogService dialogService)
        {
            this.container     = container;
            this.dialogService = dialogService;

            Configuration config;

#if DEBUG
            config = Configuration.Debug;
#else
            config = Configuration.Release;
#endif

            this.Package = new Package(ProcessExecutable.Name(), ProcessExecutable.AssemblyVersion(), config);

            this.ShowLicenseCommand = new DelegateCommand(() =>
            {
                var view = this.container.Resolve <InformationAboutLicense>();

                this.dialogService.ShowCustomDialog(
                    0xe73e,
                    16,
                    ResourceUtils.GetStringResource("Language_License"),
                    view,
                    400,
                    0,
                    false,
                    true,
                    true,
                    false,
                    ResourceUtils.GetStringResource("Language_Ok"),
                    string.Empty,
                    null);
            });
        }
        public InformationAboutViewModel(IUnityContainer container, IDialogService dialogService)
        {
            this.container     = container;
            this.dialogService = dialogService;

            this.Package            = new Package(ProcessExecutable.Name(), ProcessExecutable.AssemblyVersion());
            this.ShowLicenseCommand = new DelegateCommand(() => this.ShowLicense());
        }
Exemple #3
0
 private LogClient()
 {
     this.logfolder         = Path.Combine(SettingsClient.ApplicationFolder(), "Log");
     this.logfile           = System.IO.Path.Combine(this.logfolder, ProcessExecutable.Name() + ".log");
     this.logEntries        = new Queue <LogEntry>();
     this.logTimer.Interval = 25;
     this.logTimer.Elapsed += LogTimer_Elapsed;
 }
Exemple #4
0
        private void ExecuteEmergencyStop(Exception ex)
        {
            LogClient.Error("Unhandled Exception. {0}", LogClient.GetAllExceptions(ex));

            // Close the application to prevent further problems
            LogClient.Info("### FORCED STOP of {0}, version {1} ###", ProcessExecutable.Name(), ProcessExecutable.AssemblyVersion().ToString());

            // Emergency save of the settings
            SettingsClient.Write();

            Application.Current.Shutdown();
        }
Exemple #5
0
        public Splash()
        {
            Configuration config;

#if DEBUG
            config = Configuration.Debug;
#else
            config = Configuration.Release;
#endif

            this.package = new Package(ProcessExecutable.Name(), ProcessExecutable.AssemblyVersion(), config);

            InitializeComponent();
        }
Exemple #6
0
        public InformationAboutViewModel(IUnityContainer container, IDialogService dialogService)
        {
            this.container     = container;
            this.dialogService = dialogService;

            Configuration config;

#if DEBUG
            config = Configuration.Debug;
#else
            config = Configuration.Release;
#endif

            this.Package            = new Package(ProcessExecutable.Name(), ProcessExecutable.AssemblyVersion(), config);
            this.ShowLicenseCommand = new DelegateCommand(() => this.ShowLicense());
        }
Exemple #7
0
        public InformationAboutViewModel(IUnityContainer container, IDialogService dialogService)
        {
            this.container     = container;
            this.dialogService = dialogService;

            Configuration config;

#if DEBUG
            config = Configuration.Debug;
#else
            config = Configuration.Release;
#endif

            this.Package = new Package(ProcessExecutable.Name(), ProcessExecutable.AssemblyVersion(), config);

            this.ShowLicenseCommand = new DelegateCommand(() =>
            {
                var view = this.container.Resolve <InformationAboutLicense>();

                this.dialogService.ShowCustomDialog(
                    0xe73e,
                    16,
                    ResourceUtils.GetString("Language_License"),
                    view,
                    400,
                    0,
                    false,
                    true,
                    true,
                    false,
                    ResourceUtils.GetString("Language_Ok"),
                    string.Empty,
                    null);
            });

            this.OpenLinkCommand = new DelegateCommand <string>((url) =>
            {
                try
                {
                    Actions.TryOpenLink(url);
                }
                catch (Exception ex)
                {
                    LogClient.Error("Could not open link {0}. Exception: {1}", url, ex.Message);
                }
            });
        }
Exemple #8
0
        public AboutViewModel(IDialogService dialogService)
        {
            this.dialogService = dialogService;

            Configuration config;

#if DEBUG
            config = Configuration.Debug;
#else
            config = Configuration.Release;
#endif

            this.Package = new Package(ProcessExecutable.Name(), ProcessExecutable.AssemblyVersion(), config);

            this.ShowLicenseCommand = new RelayCommand(() =>
            {
                AboutLicense view = SimpleIoc.Default.GetInstance <AboutLicense>();

                this.dialogService.ShowCustomDialog(
                    ResourceUtils.GetStringResource("Language_License"),
                    view,
                    400,
                    0,
                    false,
                    true,
                    false,
                    ResourceUtils.GetStringResource("Language_Ok"),
                    string.Empty,
                    null);
            });

            this.OpenLinkCommand = new RelayCommand <string>((link) =>
            {
                try
                {
                    Actions.TryOpenLink(link);
                }
                catch (Exception ex)
                {
                    LogClient.Error("Could not open the link {0} in Internet Explorer. Exception: {1}", link, ex.Message);
                }
            });
        }
Exemple #9
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Check that there is only one instance of the application running
            bool isNewInstance = false;

            instanceMutex = new Mutex(true, string.Format("{0}-{1}", ProductInformation.ApplicationGuid, ProcessExecutable.AssemblyVersion().ToString()), out isNewInstance);

            // Process the commandline arguments
            this.ProcessCommandLineArguments(isNewInstance);

            if (isNewInstance)
            {
                instanceMutex.ReleaseMutex();
                this.ExecuteStartup();
            }
            else
            {
                LogClient.Warning("{0} is already running. Shutting down.", ProcessExecutable.Name());
                this.Shutdown();
            }
        }
Exemple #10
0
        private SettingsClient()
        {
            this.timer          = new System.Timers.Timer(100); // a 10th of a second
            this.timer.Elapsed += new ElapsedEventHandler(Timer_Elapsed);

            // Check in BaseSettings.xml if we're using the portable application
            this.baseSettingsDoc = XDocument.Load(this.baseSettingsFile);

            if (this.applicationFolder == null)
            {
                bool isPortable = false;

                // Set the path of Settings.xml
                if (this.TryGetBaseValue <bool>("Configuration", "IsPortable", ref isPortable))
                {
                    // Sets the application folder
                    if (isPortable)
                    {
                        this.applicationFolder = System.IO.Path.Combine(ProcessExecutable.ExecutionFolder(), ProcessExecutable.Name());
                    }
                    else
                    {
                        this.applicationFolder = System.IO.Path.Combine(WindowsPaths.AppData(), ProcessExecutable.Name());
                    }
                }
                else
                {
                    // By default, we save in the user's Roaming folder
                    this.applicationFolder = System.IO.Path.Combine(WindowsPaths.AppData(), ProcessExecutable.Name());
                }

                this.TryCreateApplicationFolder();
            }

            this.settingsFile = Path.Combine(this.applicationFolder, "Settings.xml");

            // Make sure there is a settings file.
            if (!File.Exists(this.settingsFile))
            {
                File.Copy(this.baseSettingsFile, this.settingsFile, true);
            }

            // Load the settings in memory
            this.LoadSettings();
        }
Exemple #11
0
        private void ExecuteStartup()
        {
            LogClient.Info("### STARTING {0}, version {1}, IsPortable = {2}, Windows version = {3} ({4}) ###", ProcessExecutable.Name(), ProcessExecutable.AssemblyVersion().ToString(), SettingsClient.BaseGet <bool>("Configuration", "IsPortable").ToString(), EnvironmentUtils.GetFriendlyWindowsVersion(), EnvironmentUtils.GetInternalWindowsVersion());

            // Handler for unhandled AppDomain exceptions
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);


            // Create a jumplist and assign it to the current application
            JumpList jl = new JumpList();

            JumpList.SetJumpList(Application.Current, jl);

            // Show the Splash Window
            Window splashWin = new Splash();

            splashWin.Show();
        }
Exemple #12
0
        private SettingsClient()
        {
            this.timer          = new System.Timers.Timer(100); // a 10th of a second
            this.timer.Elapsed += new ElapsedEventHandler(Timer_Elapsed);

            // Check in BaseSettings.xml if we're using the portable application
            this.baseSettingsDoc = XDocument.Load(this.baseSettingsFile);

            if (this.applicationFolder == null)
            {
                bool isPortable = false;

                // Set the path of Settings.xml
                if (this.TryGetBaseValue <bool>("Configuration", "IsPortable", ref isPortable))
                {
                    // Sets the application folder
                    if (isPortable)
                    {
                        this.applicationFolder = System.IO.Path.Combine(ProcessExecutable.ExecutionFolder(), ProcessExecutable.Name());
                    }
                    else
                    {
                        this.applicationFolder = System.IO.Path.Combine(LegacyPaths.AppData(), ProcessExecutable.Name());
                    }
                }
                else
                {
                    // By default, we save in the user's Roaming folder
                    this.applicationFolder = System.IO.Path.Combine(LegacyPaths.AppData(), ProcessExecutable.Name());
                }

                this.TryCreateApplicationFolder();
            }

            this.settingsFile = System.IO.Path.Combine(this.applicationFolder, "Settings.xml");

            // Check if Settings.xml exists in the given path. If not,
            // create a new Settings.xml based on BaseSettings.xml
            if (!File.Exists(this.settingsFile))
            {
                File.Copy(this.baseSettingsFile, this.settingsFile);
            }

            try
            {
                // Load Settings.xml in memory
                this.settingsDoc = XDocument.Load(this.settingsFile);
            }
            catch (System.Exception)
            {
                // After a crash, the Settings file is sometimes empty.  If that
                // happens, copy the BaseSettings file (there is no way to restore
                // settings from a broken file anyway) and try to load the Settings
                // file again.
                File.Copy(this.baseSettingsFile, this.settingsFile, true);
                this.settingsDoc = XDocument.Load(this.settingsFile);
            }
        }
Exemple #13
0
        private void ShowErrorDetails()
        {
            DateTime currentTime       = DateTime.Now;
            string   currentTimeString = currentTime.Year.ToString() + currentTime.Month.ToString() + currentTime.Day.ToString() + currentTime.Hour.ToString() + currentTime.Minute.ToString() + currentTime.Second.ToString() + currentTime.Millisecond.ToString();

            string path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), ProcessExecutable.Name() + "_" + currentTimeString + ".txt");

            System.IO.File.WriteAllText(path, this.errorMessage);
            System.Diagnostics.Process.Start(path);
        }