Beispiel #1
0
   public BuildContextWrapper(IList<BuildMessage> buildMessages, ISettingsInfo applicationSettings, IApplicationInfo applicationInfo,
 string projectFileName, Action buildIsFinished, string sourceStoreDirectory, bool onlyCheck)
   {
       this.buildMessages = buildMessages;
         this.ApplicationSettings = applicationSettings;
         this.ApplicationInfo = applicationInfo;
         this.ProjectFileName = projectFileName;
         this.BuildIsFinished = buildIsFinished;
         this.SourceStoreDirectory = sourceStoreDirectory;
         this.OnlyCheck = onlyCheck;
   }
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsFile"/> class
        /// </summary>
        /// <param name="settings">Settings data</param>
        public SettingsFile(ISettingsInfo settings)
        {
            // NULL-check the settings parameter
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            // Set the settings property
            this.Data = settings as SettingsInfo;

            // Set the default path value
            this.Path = $"{System.IO.Directory.GetCurrentDirectory()}\\Settings.dat";
        }
Beispiel #3
0
        public MainViewModel()
        {
            // Получение исполняемой сборки для обращения к атрибутам.
              Assembly assembly = Assembly.GetExecutingAssembly();

              // Получение заголовка программы.
              AssemblyTitleAttribute title = (AssemblyTitleAttribute)assembly.
            GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0];
              applicationTitleBase = title.Title;

              // Получение директории для настроек.
              AssemblyProductAttribute product = (AssemblyProductAttribute)assembly.
            GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];
              SettingsManager.Directory = Path.Combine(
            Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ST", product.Product);
              settingsInfo = new SettingsManager().Load();

              Predicate<object> canExecute = (obj) => { return BuilderViewModel != null; };

              CreateMsiCommand = new RelayCommand(param => CreateBuilder(CreatedBuilderType.Msi, true));
              CreateMspCommand = new RelayCommand(param => CreateBuilder(CreatedBuilderType.Msp, true));
              OpenCommand = new RelayCommand(param => Open());
              SaveCommand = new RelayCommand(param => Save(true), canExecute);
              SaveAsCommand = new RelayCommand(param => Save(false), canExecute);
              CloseCommand = new RelayCommand(param => Close(), canExecute);
              ExitCommand = new RelayCommand(param => Exit());
              SettingsCommand = new RelayCommand(param => ChangeSettings());
              CheckCommand = new RelayCommand(param => Build(true), canExecute);
              BuildCommand = new RelayCommand(param => Build(false), canExecute);

              CreateRibbon();
        }
Beispiel #4
0
 public void Build(ISettingsInfo settingsInfo, IApplicationInfo applicationInfo, bool onlyCheck)
 {
     IsBuilding = true;
       // Внимание!!! Делегат вызовется не из UI потока.
       BuildContextWrapper context = new BuildContextWrapper(BuildMessages, settingsInfo, applicationInfo, LoadedFileName,
     delegate { IsBuilding = false; }, fileStore.StoreDirectory, onlyCheck);
       MainItem.Build(context);
 }
 public void Build(ISettingsInfo settingsInfo, IApplicationInfo applicationInfo, bool onlyCheck)
 {
     Model.Build(settingsInfo, applicationInfo, onlyCheck);
 }
 public void Save(ISettingsInfo info)
 {
     XmlSaverLoader.Save<SettingsInfo>(SettingsInfo.CreateFrom(info), FileName);
 }
 public static SettingsInfo CreateFrom(ISettingsInfo info)
 {
     SettingsInfo result = new SettingsInfo();
     SettingsInfoCopier.Copy(result, info);
     return result;
 }