Ejemplo n.º 1
0
        bool SaveAs()
        {
            if (ProgramProvider.Program == null)
            {
                return(true);
            }
            var filename = FilenameProvider.GetSaveFileName(Resources.Strings.TitleBarViewModel_SaveProgramAs);

            if (!string.IsNullOrEmpty(filename))
            {
                return(false);
            }

            Mouse.OverrideCursor = Cursors.Wait;
            var result = ProgramAccessor.Save(filename, ProgramProvider.Program);

            Mouse.OverrideCursor = null;

            if (result)
            {
                StatusUpdateProvider.Publish(string.Format(Resources.Strings.TitleBarViewModel_SavedProgramAs, ProgramProvider.Program.FileName));
                return(true);
            }
            StatusUpdateProvider.Publish(string.Format(Resources.Strings.TitleBarViewModel_CouldNotSaveProgram, ProgramProvider.Program.FileName));
            return(false);
        }
Ejemplo n.º 2
0
 public static void Init(
     Assembly assembly, ProgramAccessor root, ModEventBus eventBus, List <Injector> injectors)
 {
     Assembly  = assembly;
     Root      = root;
     EventBus  = eventBus;
     Injectors = injectors;
 }
Ejemplo n.º 3
0
        bool Load()
        {
            var filename = FilenameProvider.GetLoadFileName();

            if (string.IsNullOrEmpty(filename))
            {
                return(false);
            }

            Mouse.OverrideCursor    = Cursors.Wait;
            ProgramProvider.Program = ProgramAccessor.Load(filename);
            Mouse.OverrideCursor    = null;

            StatusUpdateProvider.Publish(string.Format(Resources.Strings.TitleBarViewModel_LoadedProgram, filename));
            return(true);
        }