public ConnectionController(INetworkDataService networkDataService, IClientsHolder clientsHolder, IClientWriter clientWriter, IClientDisconnector clientDisconnector)
 {
     this._clientDisconnector = clientDisconnector;
     this._clientWriter       = clientWriter;
     this._clientsHolder      = clientsHolder;
     _networkDataService      = networkDataService;
 }
Exemple #2
0
        public NetworkViewModel(INetworkDataService _networkData)
        {
            ArrangeCommand = new RelayCommand(ExecuteArrangeCommand);
            ScatterCommand = new RelayCommand(ExecuteScatterCommand);

            VisualLoadedCommand = new RelayCommand <FrameworkElement>(ExecuteVisualLoadedCommand);

            Messenger.Default.Register <DragStartedMessage>(this, DragStarted);
            Messenger.Default.Register <DragMessage>(this, Drag);
            Messenger.Default.Register <DragCompletedMessage>(this, DragCompleted);
            Messenger.Default.Register <SelectedNodeChanged>(this, NodeChanged);
            Messenger.Default.Register <NodeVisualLoaded>(this, NodeVisualLoaded);

            int z = 1;
            List <IOperationViewModel> tmp = new List <IOperationViewModel>();

            foreach (var modelType in _networkData.ModelMap.Values)
            {
                var instances = SimpleIoc.Default.GetAllInstances(modelType).Cast <IOperationViewModel>().ToList();
                tmp.AddRange(instances);
            }
            foreach (var operation in _networkData.Operations)
            {
                var           operationModel = tmp.First(x => x.Operation == operation);
                NodeViewModel nodeViewModel  = new NodeViewModel(this, (IOperationViewModel)operationModel);
                //nodeViewModel.X += 10 * z;
                //nodeViewModel.Y += 10 * z;
                Nodes.Add(nodeViewModel);

                Edges.Add(nodeViewModel.LeftEdgeViewModel);
                Edges.Add(nodeViewModel.RightEdgeViewModel);
                z++;
            }
        }
Exemple #3
0
 public ClientCreator(INetworkDataService networkDataService, IClientWriter clientWriter, IClientsHolder clientsHolder, IClientDisconnector clientDisconnector)
 {
     this._clientDisconnector = clientDisconnector;
     this._clientsHolder      = clientsHolder;
     this._clientWriter       = clientWriter;
     this._networkDataService = networkDataService;
 }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the ViewModelLocator class.
        /// </summary>
        public ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);



            if (ViewModelBase.IsInDesignModeStatic)
            {
                SimpleIoc.Default.Unregister <DesignTimeNetworkDataService>();
                SimpleIoc.Default.Register <DesignTimeNetworkDataService>(() => new DesignTimeNetworkDataService());
                if (!SimpleIoc.Default.IsRegistered <INetworkDataService>())
                {
                    SimpleIoc.Default.Register <INetworkDataService, DesignTimeNetworkDataService>();
                }
            }
            else
            {
                SimpleIoc.Default.Register <RuntimeNetworkDataService>(() => new RuntimeNetworkDataService(), true);
                if (!SimpleIoc.Default.IsRegistered <INetworkDataService>())
                {
                    SimpleIoc.Default.Register <INetworkDataService, RuntimeNetworkDataService>();
                }
            }

            INetworkDataService dataService = SimpleIoc.Default.GetInstance <INetworkDataService>();

            foreach (var t in dataService.ModelMap)
            {
                IoCRegisterService(t.Key, t.Value);
            }


            foreach (var op in dataService.Operations)
            {
                Guid guid = Guid.NewGuid();
                Type k    = dataService.ModelMap[op.GetType()];
                IoCRegisterInstance(op, k, guid.ToString());
            }

            SimpleIoc.Default.Register <MainViewModel>();
            SimpleIoc.Default.Register <NetworkViewModel>();
        }
 public ClientWriter(IClientsHolder clientHolder, INetworkDataService networkDataService)
 {
     this._networkDataService = networkDataService;
     this._clientsHolder      = clientHolder;
 }
 public NetworkConnectionController(INetworkDataService networkDataService, ICurrentUser currentUser)
 {
     _networkDataService      = networkDataService;
     _currentUser             = currentUser;
     _cancellationTokenSource = new CancellationTokenSource();
 }
Exemple #7
0
 public RedmineDataConverter()
 {
     networkService = new RedmineService();
 }