Ejemplo n.º 1
0
 public static Mashup OpenMashupInteractive(string fileName, out MashupFileWarningList warningList)
 {
     if (File.Exists(Mashup.GetAutoSaveName(fileName)))
     {
         RecoverAutoSavedFileDialog recoverAutoSavedFileDialog = new RecoverAutoSavedFileDialog();
         recoverAutoSavedFileDialog.Initialize(Mashup.GetAutoSaveName(fileName));
         DialogResult dialogResult = recoverAutoSavedFileDialog.ShowDialog();
         if (dialogResult == DialogResult.Yes)
         {
             Mashup mashup = new Mashup(Mashup.GetAutoSaveName(fileName), out warningList);
             mashup.fileName = Path.Combine(Path.GetDirectoryName(fileName), "Copy of " + Path.GetFileName(fileName));
             mashup.SetDirty();
             mashup.AutoSaveBackup();
             File.Delete(Mashup.GetAutoSaveName(fileName));
             return(mashup);
         }
         if (dialogResult == DialogResult.Ignore)
         {
             File.Delete(Mashup.GetAutoSaveName(fileName));
         }
         else
         {
             if (dialogResult == DialogResult.Cancel)
             {
                 warningList = null;
                 return(null);
             }
             D.Assert(false, "Invalid enum");
         }
     }
     return(new Mashup(fileName, out warningList));
 }
Ejemplo n.º 2
0
		public static Mashup OpenMashupInteractive(string fileName, out MashupFileWarningList warningList)
		{
			if (File.Exists(Mashup.GetAutoSaveName(fileName)))
			{
				RecoverAutoSavedFileDialog recoverAutoSavedFileDialog = new RecoverAutoSavedFileDialog();
				recoverAutoSavedFileDialog.Initialize(Mashup.GetAutoSaveName(fileName));
				DialogResult dialogResult = recoverAutoSavedFileDialog.ShowDialog();
				if (dialogResult == DialogResult.Yes)
				{
					Mashup mashup = new Mashup(Mashup.GetAutoSaveName(fileName), out warningList);
					mashup.fileName = Path.Combine(Path.GetDirectoryName(fileName), "Copy of " + Path.GetFileName(fileName));
					mashup.SetDirty();
					mashup.AutoSaveBackup();
					File.Delete(Mashup.GetAutoSaveName(fileName));
					return mashup;
				}
				if (dialogResult == DialogResult.Ignore)
				{
					File.Delete(Mashup.GetAutoSaveName(fileName));
				}
				else
				{
					if (dialogResult == DialogResult.Cancel)
					{
						warningList = null;
						return null;
					}
					D.Assert(false, "Invalid enum");
				}
			}
			return new Mashup(fileName, out warningList);
		}