classdef autoblksMbcGenCalTask < autoblksBlkSetupTask
% Generate tables from MBC model

% Copyright 2018-2020 The MathWorks, Inc. 
    
properties
    BaseMbcProject autoblksMbcSetupProject
    BaseCageProject autoblksCageSetupProject
end

methods
    %% Constructor
    function obj = autoblksMbcGenCalTask(BaseMbcProject, InputBaseCageProject)
        obj.BaseMbcProject = BaseMbcProject;
        obj.BaseCageProject = InputBaseCageProject;
        obj.TaskName = getString(message('autoblks_shared:autoblkSharedMisc:genCal'));
        obj.Description = getString(message('autoblks_shared:autoblkSharedMisc:genCalDesc'));
        obj.EnableViewAppButton = true;
    end
    
    %% TaskFcn
    function TaskFcn(obj)
        obj.BaseMbcProject.GetProject;
        obj.BaseCageProject.GetProject(true); 
        obj.BaseCageProject.ImportMdls;
        obj.BaseCageProject.SaveProject;
    end
    
    %% GetStatusFcn
    function GetStatusFcn(obj)
        obj.BaseMbcProject.GetProject;
        obj.BaseCageProject.GetProject;
        obj.Completed = obj.BaseCageProject.isMdlUpdated;
        obj.ErrorMsg = [];
        obj.WarningMsg = [];
    end
    
    %% ViewInApp
    function ViewInApp(obj)
        obj.BaseCageProject.GetProject;
        obj.BaseCageProject.OpenProject;
    end

    function ViewChildInApp(obj,name)
        obj.BaseCageProject.GetProject;
        obj.BaseCageProject.OpenProjectandView(name);
    end
end
    
end