Exemplo n.º 1
0
        internal static void InitializeSettings()
        {
            var appDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;

            if (instance.isFirstStart)
            {
                var win = new FirstStartWindow();
                win.Owner = instance.window;
                win.ShowDialog();
            }

            if (string.IsNullOrEmpty(Properties.Settings.Default.SongTemplateFile))
            {
                Properties.Settings.Default.SongTemplateFile = Path.Combine(appDir.FullName, "Data", "Standard.ppl");
            }

            // set last portfolio/media directory to "My Documents" and last song directory to song repository

            if (string.IsNullOrEmpty(Properties.Settings.Default.LastPortfolioDirectory))
            {
                Properties.Settings.Default.LastPortfolioDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            if (string.IsNullOrEmpty(Properties.Settings.Default.LastMediaDirectory))
            {
                Properties.Settings.Default.LastMediaDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            if (string.IsNullOrEmpty(Properties.Settings.Default.LastSongDirectory))
            {
                Properties.Settings.Default.LastSongDirectory = Properties.Settings.Default.SongsDirectory;
            }

            // try to initialize embedded server

            if (!TryUpdateServerSettings())
            {
                MessageBox.Show(Resource.seMsgInitServerError);
                instance.window.ShowSettingsWindow();
            }

            while (!instance.TryInitDataManager())
            {
                // TODO: this message box is not shown correctly (the first time, when the window is not yet loaded)
                // TODO: show more detailed information about what's wrong (use Exceptions?)
                MessageBox.Show(Resource.seMsgInitDataError);
                instance.window.ShowSettingsWindow();
            }
        }
Exemplo n.º 2
0
		internal static void InitializeSettings()
		{
			var appDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;

			if (instance.isFirstStart)
			{
				var win = new FirstStartWindow();
				win.Owner = instance.window;
				win.ShowDialog();
			}

			if (string.IsNullOrEmpty(Properties.Settings.Default.SongTemplateFile))
			{
				Properties.Settings.Default.SongTemplateFile = Path.Combine(appDir.FullName, "Data", "Standard.ppl");
			}

			// set last portfolio/media directory to "My Documents" and last song directory to song repository

			if (string.IsNullOrEmpty(Properties.Settings.Default.LastPortfolioDirectory))
			{
				Properties.Settings.Default.LastPortfolioDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			}

			if (string.IsNullOrEmpty(Properties.Settings.Default.LastMediaDirectory))
			{
				Properties.Settings.Default.LastMediaDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			}

			if (string.IsNullOrEmpty(Properties.Settings.Default.LastSongDirectory))
			{
				Properties.Settings.Default.LastSongDirectory = Properties.Settings.Default.SongsDirectory;
			}

			// try to initialize embedded server

			if (!TryUpdateServerSettings())
			{
				MessageBox.Show(Resource.seMsgInitServerError);
				instance.window.ShowSettingsWindow();
			}

			while (!instance.TryInitDataManager())
			{
				// TODO: this message box is not shown correctly (the first time, when the window is not yet loaded)
				// TODO: show more detailed information about what's wrong (use Exceptions?)
				MessageBox.Show(Resource.seMsgInitDataError);
				instance.window.ShowSettingsWindow();
			}
		}