Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new viewmodel for a given combination of parent and child <seealso cref="ISolutionItem"/>s.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="child"></param>
        /// <returns></returns>
        private DocumentViewModelBase CreateDocumentPageViewModel(ISolutionItem parent,
                                                                  ISolutionItem child,
                                                                  IProcessItems processItems)
        {
            if (child is ProjectViewModel)
            {
                return(new EditProjectDocumentViewModel(processItems, RequestedAction));
            }

            if (child is SolutionRootViewModel)
            {
                return(new EditSolutionDocumentViewModel(processItems));
            }

            // Is a target file under a project currently selected?
            var project = parent as ProjectViewModel;
            var fileref = child as FileReferenceViewModel;

            if (project != null && fileref != null)
            {
                var vm = new EditTranslationsDocumentViewModel(processItems);

                var optionsEngine = GetService <ISettingsManager>().Options;
                var group         = optionsEngine.GetOptionGroup("Options");

                vm.InitializeSettings(group);

                return(vm);
            }

            throw new System.NotImplementedException(string.Format("No default view available for {0} with child: {1}",
                                                                   (parent == null ? "(null)" : parent.GetType().ToString()),
                                                                   (child == null ? "(null)" : child.GetType().ToString())));
        }
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="document"></param>
 public StringCollectionDiffViewModel(IStringCollectionDiffViewModelParent document,
                                      IProcessItems processItems)
     : this()
 {
     mProcessItems = processItems;
     mDocumentBase = document;
 }
        /// <summary>
        /// Class constructor
        /// </summary>
        public EditTranslationsDocumentViewModel(IProcessItems processItems)
            : base(null)
        {
            mProcessItems = processItems;
            mStringDiff   = new StringCollectionDiffViewModel(this, mProcessItems);

            ColorGridOption     = true;
            mAlternateGridColor = System.Windows.Media.Color.FromScRgb(0x10, 0x33, 0x99, 0xff);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Class constructor from parameter. The given solution is expected to contain at least 1 project.
        /// </summary>
        public EditPageViewModel(TranslatorSolution solutionModel,
                                 string solutionPath,
                                 string solutionName,
                                 IProcessItems processItems,
                                 ApplicationRequestEventHandler requestedAction)
            : this()
        {
            RequestedAction = requestedAction;

            mProcessItems = processItems;
            mSolution     = new SolutionViewModel(solutionModel, solutionPath, solutionName);

            mSolutionSelectedItem = null;
            CurrentEditPage       = null;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public EditSolutionDocumentViewModel(IProcessItems processItems)
     : base()
 {
     BookmarkedLocations = this.ConstructBookmarks();
     DropDownBrowser     = InitializeDropDownBrowser(SourceFilePath);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Class constructor from paramters
 /// </summary>
 /// <param name="processItems"></param>
 public PageManagerViewModel(IProcessItems processItems)
     : this()
 {
     mProcessItems = processItems;
     ViewException = new ExceptionViewModel();
 }
 /// <summary>
 /// Class constructor
 /// </summary>
 public EditProjectDocumentViewModel(IProcessItems processItems,
                                     ApplicationRequestEventHandler requestedAction)
     : base(requestedAction)
 {
 }