Exemplo n.º 1
0
 /* ----------------------------------------------------------------- */
 ///
 /// InsertViewModel
 ///
 /// <summary>
 /// Initializes a new instance of the InsertViewModel with the
 /// specified argumetns.
 /// </summary>
 ///
 /// <param name="callback">Callback function.</param>
 /// <param name="i">Selected index.</param>
 /// <param name="n">Number of pages.</param>
 /// <param name="io">I/O handler.</param>
 /// <param name="context">Synchronization context.</param>
 ///
 /* ----------------------------------------------------------------- */
 public InsertViewModel(Action <int, IEnumerable <FileItem> > callback,
                        int i, int n, IO io, SynchronizationContext context) :
     base(() => Properties.Resources.TitleInsert, new Messenger(), context)
 {
     Model    = new InsertFacade(i, n, io, context);
     Position = new InsertPosition(Data);
     DragMove = new InsertDropTarget((f, t) => Model.Move(f, t));
     DragAdd  = new BindableCommand <string[]>(e => Model.Add(e), e => true);
     SetCommands(callback);
 }
Exemplo n.º 2
0
        /* ----------------------------------------------------------------- */
        ///
        /// InsertViewModel
        ///
        /// <summary>
        /// Initializes a new instance of the InsertViewModel with the
        /// specified argumetns.
        /// </summary>
        ///
        /// <param name="callback">Callback function.</param>
        /// <param name="i">Selected index.</param>
        /// <param name="n">Number of pages.</param>
        /// <param name="io">I/O handler.</param>
        /// <param name="context">Synchronization context.</param>
        ///
        /* ----------------------------------------------------------------- */
        public InsertViewModel(Action <int, IEnumerable <FileItem> > callback,
                               int i, int n, IO io, SynchronizationContext context) :
            base(() => Properties.Resources.TitleInsert, new Aggregator(), context)
        {
            _model = new InsertFacade(i, n, io, GetDispatcher(false));

            Position   = new InsertPosViewModel(Data, Aggregator, context);
            DragMove   = new InsertDropTarget((f, t) => _model.Move(f, t));
            OK.Command = new DelegateCommand(
                () =>
            {
                Send <CloseMessage>();
                callback?.Invoke(Data.Index.Value, Data.Files);
            },
                () => Data.Files.Count > 0
                ).Associate(Data.Files);
        }