Esempio 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);
 }
Esempio n. 2
0
 /* ----------------------------------------------------------------- */
 ///
 /// InsertViewModel
 ///
 /// <summary>
 /// Initializes a new instance of the InsertViewModel with the
 /// specified arguments.
 /// </summary>
 ///
 /// <param name="callback">Callback function.</param>
 /// <param name="index">Selected index.</param>
 /// <param name="count">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 index,
                        int count,
                        IO io,
                        SynchronizationContext context
                        ) : base(new InsertFacade(index, count, io, new ContextInvoker(context, false)),
                                 new Aggregator(),
                                 context
                                 )
 {
     Position   = new PositionViewModel(Value, Aggregator, context);
     DragMove   = new InsertDropTarget((f, t) => Facade.Move(f, t));
     OK.Command = GetOkCommand(callback);
 }
Esempio n. 3
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);
        }