Пример #1
0
 public SmallVideoPresenter(ISmallView view, Action <ICameraModel> handler)
 {
     ComposContainer.Instance().Compose(this);
     if ((view != null) && (handler != null))
     {
         _view       = view;
         FullScreen += handler;
     }
 }
Пример #2
0
 public SmallSearchPresenter(ISmallSearchView view, IMainPresenter presToAdd)
 {
     ComposContainer.Instance().Compose(this);
     _view                  = view;
     _presToAdd             = presToAdd;
     _view.CreatePresenter += () => CreatePresenter();
     _view.GetCameras      += SetCameraList;
     SetCameraList();
 }
Пример #3
0
        private void ActiveXComponent_Load(object sender, EventArgs e)
        {
            ComposContainer.Instance().Compose(this);

            _initModel.Init();

            _loginPresenter            = new LoginPresenter(new LoginControl());
            _loginPresenter.Connected += ConnectionCompleted;

            LoadLoginView(_loginPresenter.GetView());
            //_loginPresenter.Connect();

            _videoPresenter = new VideoPresenter(new CameraViewer(), CloseVideoControl);
        }
Пример #4
0
 public VideoPresenter(IVideoView view, Action backHandler)
 {
     ComposContainer.Instance().Compose(this);
     if (view != null)
     {
         _view                    = view;
         _backHandler             = backHandler;
         _view.Back              += Back;
         _view.CreatePrintScreen += CreateScreen;
         BindMoveCommandHandler();
         _printScreenModel.SendMessage += ErrorMessage;
         _printScreenModel.Created     += PrintScreenCreated;
         _printScreenModel.Progress    += Progress;
     }
 }
Пример #5
0
        public MainPresenter(IMainView view, Action <ICameraModel> handler)
        {
            ComposContainer.Instance().Compose(this);
            if ((view != null) && (handler != null))
            {
                this._view                  = view;
                _handler                    = handler;
                _view.GroupsEditClick      += EditGroups;
                _view.GroupSelected        += SetActiveGroup;
                _view.ActivatedPlaybackTab += ActivatedPlayBackTab;
                _view.InitiateSearch       += () => InitiateSearch();

                _groups             = new Dictionary <Guid, Group>();
                _smallPresenters    = new List <ISmallVideoPresenter>();
                _playbackPresenters = new List <IPlaybackPresenter>();
                LoadGroups();
            }
            else
            {
                throw new NullReferenceException();
            }
        }
Пример #6
0
 public PlaybackPresenter(IPlaybackView view /*,IAudioModel audioModel*/)
 {
     ComposContainer.Instance().Compose(this);
     if (view != null)
     {
         _view = view;
         //_audioModel = audioModel;
         _playbackModel.TimeLine             = view.TimeLine;
         _view.PlayButtonPressed            += () => Play();
         _view.SlowDownButtonPressed        += () => SlowDown();
         _view.SpeedUpButtonPressed         += () => SpeedUp();
         _view.ChangeDirectionButtonPressed += () => ChangeDirection();
         _view.ResetSpeedButtonPressed      += () => ResetSpeed();
         _playbackModel.SpeedChanged        += () => UpdateSpeed();
         _view.CreateComment     += () => throw new NotImplementedException();
         _view.CreateBookMarker  += () => throw new NotImplementedException();
         _view.CreatePrintScreen += () => throw new NotImplementedException();
     }
     else
     {
         throw new NullReferenceException();
     }
 }
Пример #7
0
 public CommentService(ICommentModel commentModel)
 {
     ComposContainer.Instance().Compose(this);
     _commentModel = commentModel;
 }
Пример #8
0
using Presenter.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Reflection;

namespace Presenter
{
    /// <summary>
    /// Создает сущности сборки
    /// </summary>
    class ComposContainer
    {
        private static ComposContainer _instatnce;
        private CompositionContainer _container;

        private ComposContainer()
        {
            //Искать части проекта в директории где лежит проект
            var catalog = new DirectoryCatalog(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location.ToString()));
            _container = new CompositionContainer(catalog);
        }

        public static ComposContainer Instance()
        {
            if (_instatnce == null)
            {
                _instatnce = new ComposContainer();
            }

            return _instatnce;
        }

        public void Compose(object context)
        {
            _container.ComposeParts(context);
        }
    }
}

Пример #9
0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using View.Interfaces;
using Contract;
using Presenter.Interfaces;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Windows.Forms;

namespace Presenter
{
    /// <summary>
    ///  Презентер авторизации. 
    ///  Управляет контролом авторизации и объектом соединения.
    /// </summary>
    public class LoginPresenter : ILoginPresenter
    {
        private ILoginView _view;
        [Import(typeof(ILoginModel))]
        public ILoginModel _loginModel;
        public event Action Connected;

        public LoginPresenter(ILoginView view)
        {
            ComposContainer.Instance().Compose(this);
            if (view != null)
            {
                this._view = view;
                _view.Login += Login;
                _loginModel.Done += Done;
            }
            else
            {
                throw new Exception("Null point");
            }
            
        }


        private void Login()
        {
            if (_view.Server != null)
            {
                _view.StartProgress();
                Connect();
            }
                
        }


        private void Done()
        {
            _view.StopProgress();
            switch(_loginModel.Status)
            {
                case Contract.ConnectStatus.Ok:
                    ((UserControl) _view.GetView()).Invoke((Action) delegate
                    {
                        Connected();
Пример #10
0
 public BookMarkerService()
 {
     ComposContainer.Instance().Compose(this);
 }