コード例 #1
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="defaultNamePath"></param>
        /// <param name="requestedAction"></param>
        public OpenSolutionViewModel(string defaultNamePath = null,
                                     ApplicationRequestEventHandler requestedAction = null)
            : this()
        {
            if (defaultNamePath != null)
            {
                mDefaultDocumentLocation = System.IO.Path.GetDirectoryName(defaultNamePath);
            }

            mSolutionLocation = defaultNamePath;

            RequestedAction = requestedAction;
        }
コード例 #2
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="AppRequestHandler">
        /// Is used by this object to indicate that the current page (this object being the current page)
        /// can change and the currentpage main view show a different page better matching the requested action.
        /// </param>
        public StartPageViewModel(ApplicationRequestEventHandler AppRequestHandler, string lastActiveSolution)
        {
            mSolutionOperations = new StartPage.StartPageSolutionViewModel[2];

            // This handler is executed when either of the below viewmodel requests an action
            // Thérequest goes back to the object that called this class constructor
            RequestedAction += AppRequestHandler;

            // Construct a viewmodel for creating a new solution
            mSolutionOperations[NewSolutionViewModelIdx] = new StartPage.NewSolutionViewModel(AppLifeCycleViewModel.MyDocumentsUserDir,
                                                                                              RequestedAction);

            SolutionOperations[OpenSolutionViewModelIdx] = new StartPage.OpenSolutionViewModel(lastActiveSolution, RequestedAction);
        }
コード例 #3
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;
        }
コード例 #4
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="defaultDocumentLocation"></param>
        public NewSolutionViewModel(string defaultDocumentLocation = null,
                                    ApplicationRequestEventHandler requestedAction = null)
        {
            mComment = Project.DefaultComment;

            if (defaultDocumentLocation != null)
            {
                mDefaultDocumentLocation = defaultDocumentLocation;
            }

            mNewSolutionLocation = mDefaultDocumentLocation;

            var settings   = GetService <ISettingsManager>();
            var translator = GetService <ITranslator>();

            string comment = string.Empty;
            var    defaultTargetLanguage = settings.Options.GetOptionValue <string>("Options", "DefaultTargetLanguage");
            var    langCode = translator.LanguageList.SingleOrDefault(item => item.Bcp47_LangCode == defaultTargetLanguage);

            if (langCode != null)
            {
                comment = string.Format("Translate to {0}", langCode.FormatedString);
            }

            // Initialize solution target viewmodel with meaningful sample data
            mUpdateTargetFiles = new UpdateNewSolutionTargetFilesViewModel(this);
            mUpdateTargetFiles.ClearData();

            mUpdateTargetFiles.InitTargetSampleData(UpdateTargetFilesBaseViewModel.mDefaultTargetCollectionItemFilePathName + "\\" +
                                                    mNewTargetFilehName + "." + defaultTargetLanguage + "." + UpdateTargetFilesBaseViewModel.mDefaultTypeFileExtension,
                                                    comment,
                                                    UpdateTargetFilesBaseViewModel.mDefaultType);

            RequestedAction = requestedAction;

            BookmarkedLocations = this.ConstructBookmarks();
            DropDownBrowser     = InitializeDropDownBrowser(NewSolutionLocation);
        }
コード例 #5
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public DocumentDirtyChangedViewModelBase(ApplicationRequestEventHandler requestedAction = null)
     : base(requestedAction)
 {
 }
コード例 #6
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public DocumentViewModelBase(ApplicationRequestEventHandler requestedAction = null)
 {
     // See InitDocument method for more constrcutor relevant things...
     RequestedAction = requestedAction;
 }
コード例 #7
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public EditProjectDocumentViewModel(IProcessItems processItems,
                                     ApplicationRequestEventHandler requestedAction)
     : base(requestedAction)
 {
 }