Example #1
0
 public ConfigController(IConfigView view, ICurrentConfig config,IOpenConfigView openView)
 {
     this._config = config;
     this._view = view;
     this._openView = openView;
     this._reader = new ConfigReader(this._config);
 }
Example #2
0
 public ConfigController(IConfigView view, ICurrentConfig config, ISaveConfigView saveView)
 {
     this._config = config;
     this._view = view;
     this._saveView = saveView;
     this._reader = new ConfigReader(this._config);
 }
Example #3
0
 public ConfigPresenter(IConfigView view, IConfigRepository repository)
 {
     this.view       = view;
     view.Presenter  = this;
     this.repository = repository;
     this.game       = new Game();
 }
        public void Initialize(IConfigView configView)
        {
            _currentView = configView;

            var allitems     = StockDataItem.Volume.GetValues <StockDataItem>().ToList();
            var checkeditems = _configRepository.GetStockItems();

            _currentView.PrepopulateConfiguration(allitems, checkeditems);
        }
        public void Initialize(IConfigView configView)
        {
            _currentView = configView;

            var allitems = StockDataItem.Volume.GetValues<StockDataItem>().ToList();
            var checkeditems = _configRepository.GetStockItems();

            _currentView.PrepopulateConfiguration(allitems, checkeditems);
        }
        public ConfigViewModel(IConfigView view)
        {
            View             = view;
            View.DataContext = this;

            Model = new ConfigModel();

            SaveCommand = new DelegateCommand(() =>
            {
                Save(_fileName);
                View.DialogResult = true;
                View.Close();
            });

            CancelCommand = new DelegateCommand(() =>
            {
                View.Close();
            });
        }
        public bool IsConfigViewValid(IConfigView viewToValidate)
        {
            var connectionView = viewToValidate as PlainTextConnection;
            var mappingsView   = viewToValidate as PlainTextMappings;

            if (connectionView != null)
            {
                bool fileNameIsEmpty = string.IsNullOrEmpty(connectionView.FileName);
                if (fileNameIsEmpty)
                {
                    MessageBox.Show("Please select a CSV file to import from.", "Select a File", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                bool fileExists = File.Exists(connectionView.FileName);
                if (!fileExists)
                {
                    MessageBox.Show("The selected file does not exist.", "File not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                string extension = Path.GetExtension(connectionView.FileName);
                if (!extension.EndsWith("csv", StringComparison.InvariantCultureIgnoreCase))
                {
                    string errorMessage = string.Format("Please select a valid CSV file to import from. {0} files are not supported by this data provider.", extension.ToUpperInvariant());
                    MessageBox.Show(errorMessage, "File not Valid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                return(true);
            }
            if (mappingsView != null)
            {
                var  etor            = mappingsView.MappedFields.GetEnumerator();
                bool hasFieldsMapped = etor.MoveNext();
                if (!hasFieldsMapped)
                {
                    MessageBox.Show("Please map at least one field.", "Map", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(hasFieldsMapped);
            }
            return(true);
        }
        public void AcceptConfigViewChanges(IConfigView viewToAcceptChanges)
        {
            var connectionView = viewToAcceptChanges as PlainTextConnection;
            var mappingsView   = viewToAcceptChanges as PlainTextMappings;

            if (connectionView != null)
            {
                SourceFile    = connectionView.FileName;
                TextQualifier = connectionView.TextQualifier;
                Delimiter     = connectionView.Delimiter;
            }
            if (mappingsView != null)
            {
                MappedFields.Clear();
                foreach (var fieldMap in mappingsView.MappedFields)
                {
                    Map(fieldMap);
                }
            }
        }
Example #9
0
 public void AcceptConfigViewChanges(IConfigView viewToAcceptChanges)
 {
 }
Example #10
0
 public bool IsConfigViewValid(IConfigView viewToValidate)
 {
     return(true);
 }
Example #11
0
 public ConfigPresenter(IConfigView configView)
 {
     view = configView;
     Initializer();
 }
Example #12
0
 public void AcceptConfigViewChanges(IConfigView viewToAcceptChanges)
 {
     // Save the changes from the view. This class (the one implementing IDataSource) will be
     // serialized, so you can store anything you want here.
 }
Example #13
0
 public bool IsConfigViewValid(IConfigView viewToValidate)
 {
     // You can cast to SampleConfigView and see all the settings written there
     // and validate the file names, settings, etc.
     return(true);
 }
Example #14
0
        private void initParams()
        {
            //_curConfig = CurrentConfig.CallMe();
            this._openConfigView = new FrmTnOpenParams();
            this._openConfigView.SetConfigView(this);
            this._saveConfigView = new FrmTnSaveParams();
            this._saveConfigView.SetConfigView(this);
            ((IConfigView)this).SetOpenAndSaveView(this._openConfigView, this._saveConfigView);

            _datNnConfigView = FrmQdNongNghiep.CallMe();
            _datPnnDtConfigView = FrmQdPnnDt.CallMe();
            _datPnnntConfigView = FrmQdPnnNt.CallMe();
            _allConfigView = FrmThongSoQuyDinh.CallMe;
            List<IConfigView> lst4Nn=new List<IConfigView>();
            List<IConfigView> lst4PnnNt = new List<IConfigView>();
            List<IConfigView> lst4PnnDt = new List<IConfigView>();
            List<IConfigView> lst4This = new List<IConfigView>();
            List<IConfigView> lst4All = new List<IConfigView>();
            IConfigView _this = this as IConfigView;
            lst4Nn.Add(_this);
            lst4Nn.Add(_datPnnDtConfigView);
            lst4Nn.Add(_datPnnntConfigView);
            lst4Nn.Add(_allConfigView);
            _datNnConfigView.SetBuddy(lst4Nn);

            lst4PnnNt.Add(_this);
            lst4PnnNt.Add(_datNnConfigView);
            lst4PnnNt.Add(_datPnnDtConfigView);
            lst4PnnNt.Add(_allConfigView);
            _datPnnntConfigView.SetBuddy(lst4PnnNt);

            lst4PnnDt.Add(_this);
            lst4PnnDt.Add(_datNnConfigView);
            lst4PnnDt.Add(_datPnnntConfigView);
            lst4PnnDt.Add(_allConfigView);
            _datPnnDtConfigView.SetBuddy(lst4PnnDt);

            lst4All.Add(_this);
            lst4All.Add(_datNnConfigView);
            lst4All.Add(_datPnnntConfigView);
            lst4All.Add(_datPnnDtConfigView);
            _allConfigView.SetBuddy(lst4All);

            lst4This.Add(_datPnnntConfigView);
            lst4This.Add(_datPnnDtConfigView);
            lst4This.Add(_datNnConfigView);
            lst4This.Add(_allConfigView);
            ((IConfigView)this).SetBuddy(lst4This);
        }
Example #15
0
 void IOpenConfigView.SetConfigView(IConfigView configView)
 {
     this._configView=configView;
 }
Example #16
0
 /// <summary>
 /// Method is called if user selects the 'Config' mode.
 /// </summary>
 /// <param name="view">communication from controller to the view will be handled through
 /// the 'view' object</param>
 void IMainViewController.SetConfigView(IConfigView view)
 {
     m_ConfigView = view;
     view.SetControllerInterface(this);
 }
Example #17
0
 void ISaveConfigView.SetConfigView(IConfigView configView)
 {
     this._configView=configView;
 }
 public void SetView(IConfigView view) => _view = view;