public MainWindowViewModel()
 {
     _portableEnvironment = SetUpPortableEnvironment();
 }
        private PortableEnvironment SetUpPortableEnvironment()
        {
            PortableEnvironment portableEnvironment = null;
            try
            {
                if (EnvironmentJson.Exists)
                {
                    try
                    {
                        using (var reader = new StreamReader(EnvironmentJson.OpenRead()))
                            portableEnvironment = PortableEnvironment.Load(reader);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Failed to load " + EnvironmentJson + ": " + ex.Message, ex);
                    }
                }

                if (portableEnvironment == null)
                {
                    portableEnvironment = new PortableEnvironment();
                }

                // Create ShellLink from the shortcut info.
                portableEnvironment.Shortcuts.Add(new Shortcut
                {
                    FileName = @"%PAppsStartMenuDir%\Find more applications.lnk",
                    Target = "http://compareason.com/",
                    IconPath = Assembly.GetExecutingAssembly().Location,
                    Description = "Find more applications",
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "Failed to restore the current environment (shortcuts, environement, registry...): " + ex.Message,
                    "PApps Manager", MessageBoxButton.OK, MessageBoxImage.Error);
                throw;
            }

            return portableEnvironment;
        }