Beispiel #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public MainViewModel()
 {
     LoadedSequences = new ObservableCollection <SequenceViewModel>();
     ImportFile      = new DelegatingCommand(OnLoadFile);
     RunBlast        = new DelegatingCommand(OnBlastSequence, () => SelectedSequence != null);
     CancelBlast     = new DelegatingCommand(OnCancelBlast);
 }
        private void Initialize()
        {
            CurrentStep           = 1;
            DatabaseNames         = new MTObservableCollection <string>();
            FillDatabaseCommand   = new DelegatingCommand(() => OnFillDatabases(true));
            SelectTaxonomyCommand = new DelegatingCommand(OnTaxonomySelected);
            PreviousCommand       = new DelegatingCommand(OnPreviousStep, () => CurrentStep == 2);
            NextCommand           = new DelegatingCommand(OnNextStep, OnCanGotoNextStep);

            if (ParentTaxId != 0)
            {
                ThreadPool.QueueUserWorkItem(o =>
                {
                    for (int i = 0; i < 2; i++)
                    {
                        try
                        {
                            LoadAndFindTaxonomy();
                            break;
                        }
                        catch (SqlException)
                        {
                        }
                        catch
                        {
                            break;
                        }
                    }
                });
            }

            ThreadPool.QueueUserWorkItem(o => OnFillDatabases(false));
        }
Beispiel #3
0
 public LoaderViewModel()
 {
     ExitCommand                   = new DelegatingCommand(OnExit, OnCanExit);
     CreateRCADDBCommand           = new DelegatingCommand(OnCreateRCADDB, OnCanCreateRCADDB);
     PreviousCommand               = new DelegatingCommand(OnPreviousStep, OnCanGoToPreviousStep);
     NextCommand                   = new DelegatingCommand(OnNextStep, OnCanGoToNextStep);
     TestDBConnectionCommand       = new DelegatingCommand(OnTestDBConnection);
     RefreshDBListCommand          = new DelegatingCommand(OnRefreshDBList, OnCanRefreshDBList);
     SelectScriptTargetFileCommand = new DelegatingCommand(OnSelectTargetScriptFile, OnCanSelectScriptTargetFile);
     _connection                   = new rCADConnection();
     _connection.Host              = ".";
     _connection.Instance          = string.Empty;
     _connection.Database          = string.Empty;
     _connection.SecurityType      = SecurityType.WindowsAuthentication;
     _step                             = 1;
     _localDatabases                   = new ObservableCollection <string>();
     _workerDTS                        = new BackgroundWorker();
     _workerDTS.DoWork                += new DoWorkEventHandler(BackgroundCreateRCADDB_DTS);
     _workerDTS.RunWorkerCompleted    += new RunWorkerCompletedEventHandler(BackgroundCreateRCADDBCompleted);
     _workerSQLCMD                     = new BackgroundWorker();
     _workerSQLCMD.DoWork             += new DoWorkEventHandler(BackgroundCreateRCADDB_SQLCMD);
     _workerSQLCMD.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundCreateRCADDBCompleted);
     UsingSQLExpress                   = false;
     ScriptTargetFile                  = string.Empty;
     InitializeEnvironment();
 }
 public MainWindowView(IMainWindowViewModel viewModel)
 {
     OpenCloudExplorerCommand   = new DelegatingCommand(viewModel.OpenCloudExplorer, viewModel.CanOpenCloudExplorer);
     InvokeCommandPromptCommand = new DelegatingCommand(viewModel.InvokeCommandPrompt, viewModel.CanInvokeCommandPrompt);
     InvokeCfCliCommand         = new DelegatingCommand(viewModel.InvokeCfCli, viewModel.CanInvokeCfCli);
     DataContext = viewModel;
     InitializeComponent();
 }
Beispiel #5
0
        public ColorDialogViewModel(Element element)
        {
            _element          = element;
            ViewLoadedCommand = new DelegatingCommand(OnLoad);

            Colors = (from color in typeof(System.Windows.Media.Colors).GetProperties()
                      select color.Name).ToList();
        }
Beispiel #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 protected BioViewModel()
 {
     _isDocked    = true;
     OptionsMenu  = new ObservableCollection <MenuItem>();
     EditMenu     = new ObservableCollection <MenuItem>();
     ViewMenu     = new ObservableCollection <MenuItem>();
     CloseCommand = new DelegatingCommand(RaiseCloseRequest);
 }
        /// <summary>
        /// Constructor
        /// </summary>
        public MainViewModel()
        {
            LoadedSequences = new ObservableCollection <SequenceViewModel>();

            ImportFile        = new DelegatingCommand(OnLoadFile);
            AlignSequences    = new DelegatingCommand(OnAlignSequences, () => SelectedSequences.Count >= 2);
            AssembleSequences = new DelegatingCommand(OnAssembleSequences, () => SelectedSequences.Count >= 2);
            TransformSequence = new DelegatingCommand(OnTransformSequences, () => SelectedSequences.Count > 0 && SelectedSequences.Any(si => si.Alphabet.IsComplementSupported));
        }
 public MainViewModel()
 {
     CmdInsert = new DelegatingCommand(DoInsert, CanDoInsert);
     CmdEdit   = new DelegatingCommand(DoEdit, CanDoEdit);
     CmdCancel = new DelegatingCommand(DoCancel, CandDoCancel);
     CmdDelete = new DelegatingCommand(DoDelete, CanDoDelete);
     CmdSave   = new DelegatingCommand(DoSave, CanDoSave);
     LoadUsers();
 }
Beispiel #9
0
        // ------------------------------
        // private
        // ------------------------------
        private void InitMenu()
        {
            _rotate90        = new ToolStripMenuItem();
            _rotate90.Text   = "右へ90度回転";
            _rotate90.Click += (sender, e) => {
                var fig = _owner.Figure as IRotatable;
                if (fig != null)
                {
                    var cmd = new DelegatingCommand(
                        () => fig.Rotate(90),
                        () => fig.Rotate(270)
                        );
                    GetExecutor().Execute(cmd);
                }
            };

            _rotate270        = new ToolStripMenuItem();
            _rotate270.Text   = "左へ90度回転";
            _rotate270.Click += (sender, e) => {
                var fig = _owner.Figure as IRotatable;
                if (fig != null)
                {
                    var cmd = new DelegatingCommand(
                        () => fig.Rotate(270),
                        () => fig.Rotate(90)
                        );
                    GetExecutor().Execute(cmd);
                }
            };

            _flipHorizontal        = new ToolStripMenuItem();
            _flipHorizontal.Text   = "左右反転";
            _flipHorizontal.Click += (sender, e) => {
                var fig = _owner.Figure as IFlippable;
                if (fig != null)
                {
                    var cmd = new DelegatingCommand(
                        () => fig.FlipHorizontal(),
                        () => fig.FlipHorizontal()
                        );
                    GetExecutor().Execute(cmd);
                }
            };
            _flipVertical        = new ToolStripMenuItem();
            _flipVertical.Text   = "上下反転";
            _flipVertical.Click += (sender, e) => {
                var fig = _owner.Figure as IFlippable;
                if (fig != null)
                {
                    var cmd = new DelegatingCommand(
                        () => fig.FlipVertical(),
                        () => fig.FlipVertical()
                        );
                    GetExecutor().Execute(cmd);
                }
            };
        }
Beispiel #10
0
        internal GameViewModel(IGameDataService dataService)
        {
            this._dataService = dataService;
            dataService.GameStarted += dataService_GameStarted;
            Command_NewOfflineGame = new DelegatingCommand((p) => ExecuteCommand_NewOfflineGame(p as NewOfflineGameOptions));

            _gameGroups = new ObservableCollection<GameGroup>();
            GetGameGroups();
        }
        public OpenBioViewModel(BioViewModel vm, IBioViewProvider viewInfo)
        {
            ViewModel = vm;
            Header    = viewInfo.Description;
            Image     = viewInfo.ImageUrl;

            ActivateCommand = new DelegatingCommand(OnActivateView);
            CloseCommand    = new DelegatingCommand(() => this.ViewModel.RaiseCloseRequest());
        }
Beispiel #12
0
        public DeploymentDialogView(IDeploymentDialogViewModel viewModel)
        {
            _viewModel             = viewModel;
            UploadAppCommand       = new DelegatingCommand(viewModel.DeployApp, viewModel.CanDeployApp);
            OpenLoginDialogCommand = new DelegatingCommand(viewModel.OpenLoginView, viewModel.CanOpenLoginView);

            DataContext = viewModel;
            InitializeComponent();
        }
 public AlignmentViewModel(SequenceAlignment alignment)
 {
     _alignment       = alignment;
     _sequences       = new MTObservableCollection <SequenceViewModel>();
     MapToRCADCommand = new DelegatingCommand <rCADConnection>(MapAlignmentToRCAD, (a) => (!MappingToRCAD && !IsMappedToRCAD && a != null));
     //MapToRCADCommand = new DelegatingCommand<string>(MapAlignmentToRCAD, (a) => (!MappingToRCAD && !IsMappedToRCAD && a != null));
     LoadToRCADCommand = new DelegatingCommand <string>(LoadAlignmentToRCAD, (a) => (!MappingToRCAD && IsMappedToRCAD && _alignmentToRCADMapping != null && !LoadingToRCADFailed && !LoadingToRCAD && !IsLoadedToRCAD));
     //LoadToRCADCommand = new DelegatingCommand(LoadAlignmentToRCAD, () => (!MappingToRCAD && IsMappedToRCAD && _alignmentToRCADMapping != null && !LoadingToRCADFailed && !LoadingToRCAD && !IsLoadedToRCAD));
     Initialize();
 }
Beispiel #14
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="entities">Alignment View data</param>
        /// <param name="jumpCommand">Command to jump to a group</param>
        /// <param name="groupLevel">Grouping level</param>
        public TaxonomyJumpViewModel(IList <IAlignedBioEntity> entities, int groupLevel, ICommand jumpCommand)
        {
            Title    = "Taxonomy Browser";
            ImageUrl = "/Bio.Views.Alignment;component/images/tax_icon.png";

            Jump = jumpCommand;
            SelectRowsInAlignmentView = false;
            SelectionChanged          = new DelegatingCommand(OnSelectionChanged);
            ChangedGrouping(entities, groupLevel);
            CollapseLevel = 3;
        }
        public CloudExplorerView(ICloudExplorerViewModel viewModel)
        {
            OpenLoginFormCommand = new DelegatingCommand(viewModel.OpenLoginView, viewModel.CanOpenLoginView);
            StopCfAppCommand     = new AsyncDelegatingCommand(viewModel.StopCfApp, viewModel.CanStopCfApp);
            StartCfAppCommand    = new AsyncDelegatingCommand(viewModel.StartCfApp, viewModel.CanStartCfApp);
            DeleteCfAppCommand   = new AsyncDelegatingCommand(viewModel.DeleteCfApp, viewModel.CanDeleteCfApp);
            RefreshSpaceCommand  = new AsyncDelegatingCommand(viewModel.RefreshSpace, viewModel.CanRefreshSpace);
            RefreshAllCommand    = new AsyncDelegatingCommand(viewModel.RefreshAllCloudConnections, viewModel.CanRefreshAllCloudConnections);

            DataContext = viewModel;
            InitializeComponent();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public MainViewModel()
        {
            LoadedSequences     = new ObservableCollection <SequenceViewModel>();
            SelectedAligner     = SequenceAligners.SmithWaterman;
            SelectedAssembler   = AvailableAssemblers.FirstOrDefault();
            TranslatedSequences = new ObservableCollection <ISequence>();

            ImportFile        = new DelegatingCommand(OnLoadFile);
            AlignSequences    = new DelegatingCommand(OnAlignSequences, () => SelectedSequences.Count >= 2);
            AssembleSequences = new DelegatingCommand(OnAssembleSequences, () => SelectedSequences.Count >= 2 && SelectedAssembler != null);
            TransformSequence = new DelegatingCommand(OnTransformSequences, () => SelectedSequences.Count > 0 && SelectedSequences.Any(si => si.Alphabet.IsComplementSupported));
        }
        public MainViewModel()
        {
            _dbLaundry  = new DbLaundry();
            _unitOfWork = new UnitOfWork(_dbLaundry);

            #region Initialize Commands
            CreateTransactionCommand  = new DelegatingCommand((o) => ToolbarButtonMethod(new CreateTransactionAction(this)));
            TransactionHistoryCommand = new DelegatingCommand((o) => ToolbarButtonMethod(new TransactionHistoryAction(this)));
            ServiceCommand            = new DelegatingCommand((o) => ToolbarButtonMethod(new ServiceAction(this)));
            ShirtCommand = new DelegatingCommand((o) => ToolbarButtonMethod(new ShirtAction(this)));
            RatesCommand = new DelegatingCommand((o) => ToolbarButtonMethod(new RatesAction(this)));
            #endregion
        }
Beispiel #18
0
        public ConnectionInfoViewModel(IConnectionInfo cxInfo, Func <string> passwordGetter, Action <string> passwordSetter)
        {
            _cxInfo = cxInfo;

            _passwordGetter = passwordGetter;

            _name = cxInfo.DisplayName;

            _server   = cxInfo.DatabaseInfo.Server;
            _database = cxInfo.DatabaseInfo.Database;
            _userName = cxInfo.DatabaseInfo.UserName;

            if (!string.IsNullOrEmpty(cxInfo.DatabaseInfo.Password))
            {
                passwordSetter(cxInfo.DatabaseInfo.Password);
            }

            if (string.IsNullOrWhiteSpace(cxInfo.DatabaseInfo.CustomCxString))
            {
                _useConnectionInfo = true;
            }
            else
            {
                _useConnectionString = true;
                _connectionString    = cxInfo.DatabaseInfo.CustomCxString;
            }

            SaveCommand = new DelegatingCommand(() => Save());
            // ToDo | http://www.amazedsaint.com/2010/10/asynchronous-delegate-command-for-your.html ?
            TestConnectionCommand = new DelegatingCommand(async() => await TestConnection());

            LoadDriverData(cxInfo.DriverData);

            PropertyChanged += (sender, args) =>
            {
                switch (args.PropertyName)
                {
                case "Server":
                case "Database":
                case "ConnectionString":
                case "UseConnectionInfo":
                case "UseConnectionString":
                    UpdateCanSave();
                    UpdateHasErrors();
                    break;
                }
            };

            UpdateCanSave();
            UpdateHasErrors();
        }
Beispiel #19
0
        public SnippetsViewModel()
        {
            _snippetRepository = new SnippetRepository();
            _snippetService    = new SnippetService();

            Snippets = new ObservableCollection <Snippet>(
                _snippetRepository.GetAll());

            _snippetService.ApplySnippets(Snippets);

            AddCommand    = new DelegatingCommand(x => true, OnAdd);
            SaveCommand   = new DelegatingCommand(x => true, OnSave);
            DeleteCommand = new DelegatingCommand(x => true, OnDelete);
        }
Beispiel #20
0
        public WinViewModel()
        {
            Title    = "Window driven by WinViewModel";
            Elements = new ObservableCollection <Element>();

            ActivatedCommand       = new DelegatingCommand(() => IsActive = true);
            DeactivatedCommand     = new DelegatingCommand(() => IsActive = false);
            LoadedCommand          = new DelegatingCommand(OnLoaded);
            CloseCommand           = new DelegatingCommand(OnClosed, OnCheckClose);
            MouseEnterCommand      = new DelegatingCommand(e => Title += " (Mouse Enter)");
            MouseLeaveCommand      = new DelegatingCommand(e => Title = Title.Substring(0, 14));
            ExitCommand            = new DelegatingCommand(RaiseCloseRequest);
            ShowColorDialogCommand = new DelegatingCommand(ShowColorDialog);
        }
        public DeploymentDialogView(IDeploymentDialogViewModel viewModel, IThemeService themeService)
        {
            _viewModel                     = viewModel;
            UploadAppCommand               = new DelegatingCommand(viewModel.DeployApp, viewModel.CanDeployApp);
            OpenLoginDialogCommand         = new DelegatingCommand(viewModel.OpenLoginView, viewModel.CanOpenLoginView);
            ToggleAdvancedOptionsCommand   = new DelegatingCommand(viewModel.ToggleAdvancedOptions, viewModel.CanToggleAdvancedOptions);
            ClearBuildpackSelectionCommand = new DelegatingCommand(viewModel.ClearSelectedBuildpacks, (object arg) => { return(true); });

            themeService.SetTheme(this);
            DataContext = viewModel;
            InitializeComponent();

            MouseDown += Window_MouseDown;
        }
        public GeoFenceViewModel(OD.DataSource dataSource)
            : base(dataSource)
        {
            // init the data members with default values
            TrackIdFieldName  = "GeoFenceId";
            NameFieldName     = "Name";
            CategoryFieldName = "Category";
            ActiveFieldName   = "Active";
            Properties["GeometryServiceUrl"]    = @"http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer";
            Properties["ServiceAreaServiceUrl"] = @"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Service%20Area";

            // init the commands
            ToggleActiveCommand = new DelegatingCommand(OnToggleActive);
        }
Beispiel #23
0
        // ========================================
        // field
        // ========================================

        // ========================================
        // constructor
        // ========================================

        // ========================================
        // property
        // ========================================

        // ========================================
        // method
        // ========================================
        public override ICommand CreateCommand(IRequest request)
        {
            var req = request as ChangeBoundsRequest;

            if (req == null)
            {
                return(null);
            }

            /// ただの移動なら普通の処理
            if (req.SizeDelta.IsEmpty)
            {
                return(base.CreateCommand(req));
            }


            var node            = (INode)_Host.Figure;
            var oldAutoSizeKind = node.AutoSizeKinds;
            var oldMaxWidth     = node.MaxSize;

            var newMaxWidth = new Size(
                node.Width + req.SizeDelta.Width + GetGridAdjustedDiffX(node.Left + node.Width + req.SizeDelta.Width),
                node.MaxSize.Height
                );

            var maxSizeCmd = new DelegatingCommand(
                () => {
                node.AutoSizeKinds = AutoSizeKinds.FitHeight;
                node.MaxSize       = newMaxWidth;
                node.AdjustSize();
            },
                () => {
                node.AutoSizeKinds = oldAutoSizeKind;
                node.MaxSize       = oldMaxWidth;
                node.AdjustSize();
            }
                );

            var resizeCmd = base.CreateCommand(req);

            if (req.SizeDelta.Width < 0)
            {
                return(resizeCmd.Chain(maxSizeCmd));
            }
            else
            {
                return(maxSizeCmd.Chain(resizeCmd));
            }
        }
Beispiel #24
0
        public StopViewModel(OD.DataSource dataSource, OD.DataSource routesDataSource, StopWidget view)
            : base(dataSource)
        {
            // init _wsTimer
            _webSocketKeepAliveTimer          = new DispatcherTimer();
            _webSocketKeepAliveTimer.Interval = new TimeSpan(0, 0, 2);
            _webSocketKeepAliveTimer.Tick    += new EventHandler(OnWebSocketKeepAliveTick);

            // init _progressDialogTimer
            _progressDialogTimer       = new DispatcherTimer();
            _progressDialogTimer.Tick += new EventHandler(OnProgressDialogTimeOut);

            // init the data members with default values
            StopsRouteNameFieldName                     = @"RouteName";
            RoutesRouteNameFieldName                    = @"Route";
            Properties["GepHostName"]                   = @"localhost";
            Properties["GepHttpPort"]                   = @"6180";
            Properties["GepHttpsPort"]                  = @"6143";
            Properties["GEP_LOAD_PLAN_ENDPOINT"]        = @"geoevent/rest/receiver/route-command-in";
            Properties["GEP_ROUTES_CALCULATE_ENDPOINT"] = @"geoevent/rest/receiver/route-update-in";
            Properties["GEP_ROUTES_UPDATE_ENDPOINT"]    = @"geoevent/rest/receiver/route-update-in";
            Properties["GEP_DISPATCH_ENDPOINT"]         = @"geoevent/rest/receiver/route-message-in";
            Properties["STOPS_ROUTE_NAME_FIELD_NAME"]   = @"RouteName";
            Properties["ROUTES_ROUTE_NAME_FIELD_NAME"]  = @"RouteName";
            Properties["ROUTES_UN_ASSIGNED_ROUTE_NAME"] = @"__Unassigned__";

            _unassignedRouteName = GetPropValue("ROUTES_UN_ASSIGNED_ROUTE_NAME");
            SetRouteDataSource(routesDataSource);

            // temp
            _view = view;

            // init commands
            DispatchCommand     = new DelegatingCommand(OnDispatch);
            DispatchAllCommand  = new DelegatingCommand(OnDispatchAll);
            UnassignCommand     = new DelegatingCommand(OnUnassign);
            CutCommand          = new DelegatingCommand(OnCut);
            PasteCommand        = new DelegatingCommand(OnPaste);
            PasteOnGroupCommand = new DelegatingCommand(OnPasteOnGroup);

            _edits = new HashSet <string>();

            // Web Socket Event Handlers
            _wsOnOpenEH    = new EventHandler(WebSocket_OnOpen);
            _wsOnCloseEH   = new EventHandler <CloseEventArgs>(WebSocket_OnClose);
            _wsOnErrorEH   = new EventHandler <ErrorEventArgs>(WebSocket_OnError);
            _wsOnMessageEH = new EventHandler <MessageEventArgs>(WebSocket_OnMessage);
        }
Beispiel #25
0
        public WinViewModel()
        {
            Title           = "MVVM Test";
            BackgroundColor = "White";
            Elements        = new ObservableCollection <Element>();

            ActivatedCommand       = new DelegatingCommand(() => IsActive = true);
            DeactivatedCommand     = new DelegatingCommand(() => IsActive = false);
            LoadedCommand          = new DelegatingCommand(OnLoaded);
            CloseCommand           = new DelegatingCommand(OnClosed, OnCheckClose);
            ExitCommand            = new DelegatingCommand(RaiseCloseRequest);
            ShowColorDialogCommand = new DelegatingCommand <Element>(ShowColorDialog);
            ShowPropertiesCommand  = new DelegatingCommand(ShowPropertyDialog);
            MouseEnterLeaveCommand = new DelegatingCommand <EventParameters>(OnMouseEnterLeave);
            ChangeBackground       = new DelegatingCommand <string>(OnChangeBackground);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public MainViewModel()
        {
            LoadedSequences = new ObservableCollection <SequenceViewModel>();
            ImportFile      = new DelegatingCommand(OnLoadFile);
            RunBlast        = new DelegatingCommand(OnBlastSequence, () => SelectedSequence != null &&
                                                    SelectedBlastAlgorithm != null && IsRunning == null);
            CancelBlast = new DelegatingCommand(OnCancelBlast, () => IsRunning != null);

            BlastParameters = new ObservableCollection <KeyValue>
            {
                new KeyValue("Program", "blastn"),
                new KeyValue("Database", "nr"),
                new KeyValue("Expect", "10.0"),
                new KeyValue("Email"),
            };
        }
        public static void EmptyCell(IEditor editor)
        {
            var model = editor.Model as MemoTableCell;

            if (model != null)
            {
                var oldStext = model.StyledText;
                var newStext = new StyledText.Core.StyledText();

                var cmd = new DelegatingCommand(
                    () => model.StyledText = newStext,
                    () => model.StyledText = oldStext
                    );
                editor.Site.CommandExecutor.Execute(cmd);
            }
        }
Beispiel #28
0
 public TaxonomyUpdaterViewModel()
 {
     ExitCommand              = new DelegatingCommand(OnExit, OnCanExit);
     TestDBConnectionCommand  = new DelegatingCommand(OnTestDBConnection);
     UpdateTaxonomyCommand    = new DelegatingCommand(OnUpdateTaxonomy, OnCanUpdateTaxonomy);
     _updatingDB              = false;
     _instanceDatabases       = new ObservableCollection <string>();
     _connection              = new rCADConnection();
     _connection.Host         = ".";
     _connection.Instance     = string.Empty;
     _connection.Database     = string.Empty;
     _connection.SecurityType = SecurityType.WindowsAuthentication;
     _worker                     = new BackgroundWorker();
     _worker.DoWork             += new DoWorkEventHandler(BackgroundUpdateTaxonomy);
     _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BackgroundUpdateTaxonomyCompleted);
 }
        public ServiceViewModel(IUnitOfWork unitOfWork)
        {
            ServiceModel.unitOfWork = unitOfWork;
            _service             = new ServiceModel();
            _service.IsNewObject = true;
            _selectedService     = new ServiceModel();
            _serviceCollection   = ServiceModel.GetAllData();

            #region Initialize Commands
            AddService = new DelegatingCommand((o) => {
                ServiceModel.AddItem(_service);
                _service             = new ServiceModel();
                _service.IsNewObject = true;
            });
            RemoveService = new DelegatingCommand((o) => ServiceModel.RemoveItem(_selectedService));
            #endregion
        }
        public ShirtViewModel(IUnitOfWork unitOfWork)
        {
            ShirtModel.unitOfWork = unitOfWork;

            _shirt             = new ShirtModel();
            _shirt.IsNewObject = true;
            _selectedShirt     = new ShirtModel();
            _shirtCollection   = ShirtModel.GetAllData();

            #region Initialize Commands
            AddShirt = new DelegatingCommand((o) => {
                ShirtModel.AddItem(_shirt);
                _shirt             = new ShirtModel();
                _shirt.IsNewObject = true;
            });
            RemoveShirt = new DelegatingCommand((o) => ShirtModel.RemoveItem(_selectedShirt));
            #endregion
        }