protected ActionResult ProcessForm(Models.Settings record)
        {
            try {
                record.UpdateFromRequest();
                Validate(record);
                if (ModelState.IsValid)
                {
                    Save(record, record.IsNewRecord);
                    Web.InfoMessage = "Settings saved.";
                }
            } catch (Exception e) {
                ModelState.AddModelError("Record", e.Message);
            }

            if (!ModelState.IsValid)
            {
                // invalid so redisplay form with validation message(s)
                return(View("SettingsEdit", record));
            }
            else if (Web.Request["SaveAndRefreshButton"] != null)
            {
                return(RedirectToEdit(record.ID));
            }
            else
            {
                return(RedirectToReturnPage());
            }
        }
        //
        // GET: /Admin/Settings/


        /// <summary>
        /// Populates defaults and opens edit form to add new record
        /// GET: /Admin/Settings/Create
        /// </summary>
        public ActionResult Create()
        {
            Breadcrumbs.Current.AddBreadcrumb(3, "Add Settings");
            var record = new Models.Settings();

            // any default values can be set here or in partial class Settings.InitDefaults()
            return(View("SettingsEdit", record));
        }
示例#3
0
        public SettingsViewModel(Settings settings, ILogControlService logControlService, IDispatcherService dispatcherService)
        {
            Argument.IsNotNull(() => settings);
            Argument.IsNotNull(() => logControlService);
            Argument.IsNotNull(() => dispatcherService);

            Settings = settings;
            _logControlService = logControlService;
            _dispatcherService = dispatcherService;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public CharacterManagerViewModel(Settings settings)
        {
            this.settings = settings;

            var characters = settings.Characters.List ?? Enumerable.Empty<Character>();
            Characters = new ObservableCollection<Character>(characters);
            //			if (!settings.Installed)
            //			{
            //				LoadCharacterListFromDisk();
            //			}
        }
示例#5
0
        public object GetViewDataContext()
        {
            var settings = new Settings();

            var lastProjectPath = _configurationService.GetRoamingValue("LastProjectPath", string.Empty);
            if (!string.IsNullOrEmpty(lastProjectPath) && File.Exists(lastProjectPath))
            {
                settings.ProjectFile = lastProjectPath;
            }

            return settings;
        }
示例#6
0
		protected override async void OnStartup(StartupEventArgs e)
		{
			string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
			path        = Path.Combine(path, @"My Games\Skyrim\Settings.json");
			
			settings         = await Settings.Load(path);
			viewModel = new MainViewModel(settings);

			if (MainWindow == null)
			{
				MainWindow = new MainWindow();
			}

			MainWindow.DataContext = viewModel;
			MainWindow.Show();
		}
        public MainViewModel(Settings settings)
        {
            this.settings    = settings;

            if (!settings.Installed)
            {
                InitializeDefaults();
            }

            CharacterManager = new CharacterManagerViewModel(settings);

            BrowseDataPath         = new BrowseCommand();
            BrowseInstallPath      = new BrowseCommand();
            ExitCommand            = new ActionCommand(x => Application.Current.Shutdown(), x => true);
            ShowAboutWindowCommand = new ShowWindowCommand<AboutWindow>(owner: Application.Current.MainWindow, properties: new {ShowInTaskBar = false});

            BrowseDataPath.BrowseCompletedEvent    += selectedPath => GameDataPath = selectedPath;
            BrowseInstallPath.BrowseCompletedEvent += selectedPath => InstallPath = selectedPath;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SendGridQueueProcessor"/> class.
 /// </summary>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="dataAdapter">
 /// Data adapter
 /// </param>
 /// <param name="settings">
 /// Settings instance
 /// </param>
 public SendGridQueueProcessor(ILog logger, IDataAdapter dataAdapter, Settings settings)
     : base(logger, dataAdapter, settings)
 {
 }
 private void Save(Models.Settings record, bool isNew)
 {
     // add any code to update other fields/tables here
     record.Save();
     Settings.RebuildCache();
 }
示例#10
0
 private void Validate(Models.Settings record)
 {
     // add any code to check for validity
     //ModelState.AddModelError("Record", "Suchandsuch cannot be whatever.");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiThreadQueueProcessor"/> class.
 /// </summary>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="dataAdapter">
 /// Data adapter
 /// </param>
 /// <param name="settings">
 /// Settings instance
 /// </param>
 protected MultiThreadQueueProcessor(ILog logger, IDataAdapter dataAdapter, Settings settings)
 {
     Logger = logger;
     Settings = settings;
     DataAdapter = dataAdapter;
 }
        public FiscalPrinterHandler(Settings settings)
        {
            this.settings = settings;

            Directory.CreateDirectory(this.settings.ReceiptPath);
        }