예제 #1
0
 internal static void Hide(string file)
 {
     if (Mainframe.IsFileExists(file))
     {
         File.SetAttributes(file, FileAttributes.Hidden | File.GetAttributes(file));
     }
 }
예제 #2
0
 internal static void DeleteFile(string file)
 {
     if (Mainframe.IsFileExists(file))
     {
         try {
             File.Delete(file);
         } catch (Exception exception) {
             Tracer.Report("Mainframe.DeleteFile", exception);
         }
     }
 }
예제 #3
0
        private static CircuitProject Create(Mainframe mainframe, string file)
        {
            bool   useAutoSaveFile = false;
            string autoSaveFile    = Mainframe.AutoSaveFile(file);

            if (Mainframe.IsFileExists(autoSaveFile))
            {
                App.Dispatch(() => {
                    MessageBoxResult result = DialogMessage.Show(
                        mainframe,
                        Properties.Resources.TitleApplication,
                        Properties.Resources.MessageLoadAutoSavedFile(file),
                        null,
                        MessageBoxImage.Question,
                        MessageBoxButton.YesNo
                        );
                    if (result == MessageBoxResult.Yes)
                    {
                        useAutoSaveFile = true;
                    }
                });
                if (!useAutoSaveFile)
                {
                    Mainframe.DeleteFile(autoSaveFile);
                }
            }
            if (!useAutoSaveFile)
            {
                autoSaveFile = file;
            }
            CircuitProject project = CircuitProject.Create(autoSaveFile);

            if (useAutoSaveFile)
            {
                project.InOmitTransaction(() => {});
            }
            return(project);
        }