예제 #1
0
 private void DismissOrShowViewController(bool show, IViewController viewController) {
   if (show) {
     viewController.Show();
   } else {
     viewController.Dismiss();
   }
 }
        public LayoutPlotLogic(PlotStratum stratum, LayoutPlot view
            , FormDataEntryLogic dataEntryController
            , IViewController viewController)
        {
            this.Stratum = stratum;
            this.View = view;
            this.DataEntryController = dataEntryController;
            this.ViewController = viewController;

            this._BS_Plots = new BindingSource();
            this._BS_Trees = new BindingSource();
            ((System.ComponentModel.ISupportInitialize)(this._BS_Plots)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this._BS_Trees)).BeginInit();

            this._BS_Plots.DataSource = typeof(PlotVM);
            this._BS_Plots.CurrentChanged += new System.EventHandler(this._BS_Plots_CurrentChanged);

            this._BS_Trees.DataSource = typeof(TreeVM);
            this._BS_Trees.CurrentChanged += new System.EventHandler(this._BS_Trees_CurrentChanged);

            ((System.ComponentModel.ISupportInitialize)(this._BS_Plots)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this._BS_Trees)).EndInit();

            _BS_Plots.DataSource = this.Stratum.Plots;
        }
예제 #3
0
        public LoginDialog(IViewController views, bool isFirstRun)
        {
            this.views = views;

            InitializeComponent();

            var settings = Properties.Settings.Default;
            string username = settings.Username;
            string password = settings.Password;
            string serverName = settings.Server;

            if (username != "")
            {
                UsernameTextBox.Text = username;
                RememberUsernameCheckBox.IsChecked = true;
                PasswordTextBox.Focus();
            }
            else
                UsernameTextBox.Focus();

            var matchingServer = ServerComboBox.Items.Cast<ComboBoxItem>().SingleOrDefault(item => item.Tag as string == serverName);
            if (matchingServer != null)
                ServerComboBox.SelectedItem = matchingServer;
            else
                ServerComboBox.Text = serverName;

            if (isFirstRun && password != "")
            {
                PasswordTextBox.Password = password;
                AutoLoginCheckBox.IsChecked = true;
            }

            Loaded += OnLoaded;
        }
예제 #4
0
 public MainWindowViewModel(IGameEngine gameEngine, IObservable<IGameEvent> events,
                            IViewController viewController)
 {
     _events = events;
     _viewController = viewController;
     GameEngine = gameEngine;
     Hit = new ActionCommand(OnPlayerHit2);
 }
예제 #5
0
        static void AddExplicitRTLToScrollView(ScrollView parent, View child)
        {
            parent.Content = child;

            IViewController controller = child;

            Assume.That(controller.EffectiveFlowDirection.IsExplicit(), "child view EffectiveFlowDirection should be Implicit");
            Assume.That(controller.EffectiveFlowDirection.IsRightToLeft(), "child view EffectiveFlowDirection should be RightToLeft");
            Assume.That(child.FlowDirection == FlowDirection.RightToLeft, "child view FlowDirection should be RightToLeft");
        }
예제 #6
0
 public void RegisterToControlDynamicViews(IViewController viewController)
 {
     if (this.registeredDynamicViewsUIControllers != null)
     {
         if (!this.registeredDynamicViewsUIControllers.Contains(viewController))
         {
             this.registeredDynamicViewsUIControllers.Add(viewController);
         }
     }
 }
예제 #7
0
        static void AddExplicitLTRToScrollView(ScrollView parent, View child)
        {
            parent.Content = child;

            IViewController controller = child;

            Assume.That(controller.EffectiveFlowDirection.IsExplicit(), "child view FlowDirection should be Explicit");
            Assume.That(controller.EffectiveFlowDirection.IsLeftToRight(), "child view FlowDirection should be LeftToRight");
            Assume.That(child.FlowDirection == FlowDirection.LeftToRight, "child view FlowDirection should be LeftToRight");
        }
예제 #8
0
        static void AddExplicitRTLToLayout(StackLayout parent, View child)
        {
            parent.Children.Add(child);

            IViewController controller = child;

            Assume.That(controller.EffectiveFlowDirection.IsExplicit(), "child view EffectiveFlowDirection should be Implicit");
            Assume.That(controller.EffectiveFlowDirection.IsRightToLeft(), "child view EffectiveFlowDirection should be RightToLeft");
            Assume.That(child.FlowDirection == FlowDirection.RightToLeft, "child view FlowDirection should be RightToLeft");
        }
예제 #9
0
        static void AddImplicitToLTR(StackLayout parent, View child)
        {
            parent.Children.Add(child);

            IViewController controller = child;

            Assume.That(controller.EffectiveFlowDirection.IsImplicit(), "child view EffectiveFlowDirection should be Implicit");
            Assume.That(controller.EffectiveFlowDirection.IsLeftToRight(), "child view EffectiveFlowDirection should be LeftToRight");
            Assume.That(child.FlowDirection == FlowDirection.MatchParent, "child view FlowDirection should be MatchParent");
        }
예제 #10
0
        static void AddImplicitToLTRScrollView(ScrollView parent, View child)
        {
            parent.Content = child;

            IViewController controller = child;

            Assume.That(controller.EffectiveFlowDirection.IsImplicit(), "child view EffectiveFlowDirection should be Implicit");
            Assume.That(controller.EffectiveFlowDirection.IsLeftToRight(), "child view EffectiveFlowDirection should be LeftToRight");
            Assume.That(child.FlowDirection == FlowDirection.MatchParent, "child view FlowDirection should be MatchParent");
        }
예제 #11
0
 public void RegisterToControlFixedViews(IViewController viewController)
 {
     if (this.registeredFixedViewsUIOControllers != null)
     {
         if (!this.registeredFixedViewsUIOControllers.Contains(viewController))
         {
             this.registeredFixedViewsUIOControllers.Add(viewController);
         }
     }
 }
예제 #12
0
 public void RegisterToUpdate(IViewController updater)
 {
     if (!this.registeredControllers.Contains(updater))
     {
         this.registeredControllers.Add(updater);
     }
     else
     {
         throw new UICtrlAlreadyRegisteredException("UI controller " + updater.ToString() + " already registered");
     }
 }
예제 #13
0
		public bool TryGetInfo(IViewController controller, out IPresentInfo info)
		{
			if (_controllerMap.TryGetValue(controller, out var result))
			{
				info = result;
				return true;
			}

			info = null;
			return false;
		}
예제 #14
0
 protected override void Execute(List <GameEntity> entities)
 {
     foreach (var e in entities)
     {
         IViewController viewController = _viewCreator.InitializeViewForEntity(e);
         if (viewController != null)
         {
             e.ReplaceView(viewController);
         }
     }
 }
예제 #15
0
파일: BumpEffect.cs 프로젝트: bmjoy/Osnowa
        public virtual void Process()
        {
            IViewController view           = _entity.view.Controller;
            IEntityAnimator entityAnimator = view.Animator;
            bool            actorIsVisible = view.IsVisible;

            if (actorIsVisible)
            {
                entityAnimator.Bump(_entity.position.Position, BumpedPosition);
            }
        }
예제 #16
0
        public virtual void Process()
        {
            IViewController view           = _entity.view.Controller;
            IEntityAnimator entityAnimator = view.Animator;
            bool            actorIsVisible = view.IsVisible;

            if (actorIsVisible)
            {
                entityAnimator.KnockOut();
            }
        }
예제 #17
0
        protected virtual Task OnPush(IViewController controller)
        {
            // Set parent and sibling index...
            if (controller is ViewController viewController)
            {
                viewController.transform.SetParent(transform, false);
                viewController.transform.SetAsLastSibling();
            }

            return(Task.CompletedTask);
        }
        public ApplicationController(IViewController viewController)
        {
            viewController.ApplicationController = this;
            viewController.ApplicationClosing += new CancelEventHandler(OnApplicationClosing);
            this.ViewController = viewController;

            ExceptionHandler = new FSCruiser.WinForms.ExceptionHandler();
            ApplicationSettings.ExceptionHandler = ExceptionHandler;

            ApplicationSettings.Initialize();
        }
예제 #19
0
 public virtual void EnterState(TEnum from)
 {
     _viewController = GetViewController();
     if (_viewController != null)
     {
         Debug.Log("[AbstractViewControllerState][" + from + "] EnterState.ShowView Start");
         _viewController.Initialize(_fsm);
         _viewController.ShowView();
         Debug.Log("[AbstractViewControllerState][" + from + "] EnterState.ShowView Done");
     }
 }
예제 #20
0
        public override object ShowViewDialog(IViewController owner)
        {
            var dialogResult = View.ShowDialog(owner.View);

            if (dialogResult == DialogResult.OK)
            {
                return(generateCharts());
            }

            return(null);
        }
        public Form3PPNTPlotInfo(IViewController viewController)
        {
            _viewController = viewController;
            InitializeComponent();

            if (ViewController.PlatformType == FMSC.Controls.PlatformType.WinCE)
            {
                this.WindowState = FormWindowState.Maximized;
                this._OKBtn.Visible = true;
            }
        }
 public void SetRenderContext(IViewController controller, object context)
 {
     ClaimGenericDataItemDto genericDataItemDto = (ClaimGenericDataItemDto)context;
     ClaimModel claimModel = (ClaimModel)controller.Model;
     claimModel.SelectedDto = genericDataItemDto;
     this.handler.ClaimController = controller;
     this.handler.AttachHandler(genericDataItemDto);
     ClaimGenericDataItemData genericDataItem = (ClaimGenericDataItemData)genericDataItemDto.GenericDataItemData;
     claimModel.GenericDataItemModel.SelectedGenericDataItemDto = genericDataItemDto;
     claimModel.GenericDataItemModel.GenericDataSetContainer = (IGenericDataSetContainer)genericDataItem.ParentDto.Data.ParentDto;
 }
 private void DismissOrShowViewController(bool show, IViewController viewController)
 {
     if (show)
     {
         viewController.Show();
     }
     else
     {
         viewController.Dismiss();
     }
 }
        public static void SetDefaultRepairSequence(this IViewController viewController, IBootstrapperController bootstrapperController)
        {
            viewController.ViewCollection.RegisterView <CommitViewmodel>(new CommitViewmodel(bootstrapperController, new CommitView()));
            viewController.ViewCollection.RegisterView <ProgressViewmodel>(new ProgressViewmodel(bootstrapperController, new ProgressView()));
            viewController.ViewCollection.RegisterView <FinishViewmodel>(new FinishViewmodel(bootstrapperController, new FinishView()));

            viewController.ViewCollection.SetRepairSequence(new List <string>()
            {
                nameof(ProgressViewmodel), nameof(FinishViewmodel)
            });
        }
 public void RegisterToUpdate(IViewController updater)
 {
     if (!this.registeredControllers.Contains(updater))
     {
         this.registeredControllers.Add(updater);
     }
     else
     {
         throw new UICtrlAlreadyRegisteredException("UI controller " + updater.ToString() +" already registered");
     }
 }
        public void Present(IViewController vc)
        {
            if (this.ActiveViewController != null)
            {
                Debug.LogError("ActiveViewControllerManager->Present: attempting to present a view controller when there already is an active view controller!");
                return;
            }

            this.ActiveViewController = vc;
            this.ShowActiveViewController();
        }
        public void ReplaceActiveViewControllerWith(IViewController vc)
        {
            if (this.ActiveViewController == null)
            {
                Debug.LogError("ActiveViewControllerManager->ReplaceActiveViewControllerWith: called when there is no active view controller, probably something went wrong!");
                return;
            }

            this.DismissActiveViewController();
            this.Present(vc);
        }
        public void PushViewController(IViewController n, bool animated = false)
        {
            IViewController p = VisibleViewController;

            if (n.Equals(p))
            {
                return;
            }

            viewControllers.Push(n);
            StartAnim(p, n, NavigationType.Push, animated, false);
        }
예제 #29
0
 public void RegisterViewController(IViewController controller)
 {
     if (controller == null)
     {
         throw new ArgumentNullException("view controller");
     }
     if (_controllers.Contains(controller))
     {
         throw new InvalidOperationException(string.Format("A view controller with name {0} is already registered.  Choose another view controller.", controller.ToString()));
     }
     _controllers.Add(controller);
 }
        public static void SetDefaultSequences(this IViewController viewController, IBootstrapperController bootstrapperController)
        {
            SetDefaultStartPage(viewController, bootstrapperController);
            SetDefaultCancelPage(viewController, bootstrapperController);
            SetDefaultErrorPage(viewController, bootstrapperController);

            SetDefaultInstallSequence(viewController, bootstrapperController);
            SetDefaultUninstallSequence(viewController, bootstrapperController);
            SetDefaultUpgradeSequence(viewController, bootstrapperController);
            SetDefaultModifySequence(viewController, bootstrapperController);
            SetDefaultRepairSequence(viewController, bootstrapperController);
        }
예제 #31
0
        static View ImplicitLeftToRightView()
        {
            var view = new View();

            IViewController controller = view;

            Assume.That(controller.EffectiveFlowDirection.IsImplicit(), "New view EffectiveFlowDirection should be Implicit");
            Assume.That(controller.EffectiveFlowDirection.IsLeftToRight(), "New view EffectiveFlowDirection should be LeftToRight");
            Assume.That(((View)view).FlowDirection == FlowDirection.MatchParent, "New view FlowDirection should be MatchParent");

            return(view);
        }
예제 #32
0
        public IViewStack FindViewStackFor(IViewController controller)
        {
            foreach (var pair in _viewStacks)
            {
                if (pair.Value.Contains(controller))
                {
                    return(pair.Value);
                }
            }

            return(null);
        }
예제 #33
0
        public MainWindowViewModel(IViewController viewController)
        {
            _viewController = viewController;

            // Initialize event handlers
            _viewController.ViewIndexChangedEvent += ViewIndexUpdate;

            // Initialize relaycommand bindings
            CloseWindowCommand    = new RelayCommand <Window>(CloseWindow);
            MinimizeWindowCommand = new RelayCommand <Window>(MinimizeWindow);
            MoveWindowCommand     = new RelayCommand <Window>(MoveWindow);
        }
예제 #34
0
        static StackLayout ImplicitLeftToRightLayout()
        {
            var layout = new StackLayout();

            IViewController controller = layout;

            Assume.That(controller.EffectiveFlowDirection.IsImplicit(), "New view EffectiveFlowDirection should be Implicit");
            Assume.That(controller.EffectiveFlowDirection.IsLeftToRight(), "New view EffectiveFlowDirection should be LeftToRight");
            Assume.That(layout.FlowDirection == FlowDirection.MatchParent, "New view FlowDirection should be MatchParent");

            return(layout);
        }
 public void ChangeActiveMode(Modes newMode, IViewController updater)
 {
     //Set the modes status to Requested;
     if (this.registeredControllers.Contains(updater))
     {
         this.ActiveMode = newMode;
         this.Status = ExecutionStatus.Requested;
     }
     else
     {
         throw new UICtrlNotRegisteredException("UI controller " + updater.ToString() +" not registerd");
     }
 }
예제 #36
0
        public async Task Push(IViewController controller)
        {
            if (Contains(controller))
            {
                throw new ViewAlreadyStackedException();
            }

            _stack.Push(controller);

            await OnPush(controller);

            await controller.OnPushedOnViewStack(this);
        }
 public void DisactiveDynamicView(IModeTracking modeTracker, IViewController viewController)
 {
     if (this.registeredDynamicViewsUIControllers != null && this.modeDynamicViewMappings != null)
     {
         if (this.registeredDynamicViewsUIControllers.Contains(viewController))
         {
             if (this.modeDynamicViewMappings.ContainsKey(modeTracker.ActiveMode))
             {
                 modeDynamicViewMappings[modeTracker.ActiveMode].Disable();
             }
         }
     }
 }
 public void DisableFixedView(FixedViews fixedView, IViewController viewController)
 {
     if (this.registeredFixedViewsUIOControllers != null && this.fixedViewsMappings != null)
     {
         if (this.registeredDynamicViewsUIControllers.Contains(viewController))
         {
             if (this.fixedViewsMappings.ContainsKey(fixedView))
             {
                 fixedViewsMappings[fixedView].Disable();
             }
         }
     }
 }
예제 #39
0
 public void ChangeActiveMode(Modes newMode, IViewController updater)
 {
     //Set the modes status to Requested;
     if (this.registeredControllers.Contains(updater))
     {
         this.ActiveMode = newMode;
         this.Status     = ExecutionStatus.Requested;
     }
     else
     {
         throw new UICtrlNotRegisteredException("UI controller " + updater.ToString() + " not registerd");
     }
 }
예제 #40
0
        static StackLayout ExplicitLeftToRightLayout()
        {
            var layout = new StackLayout {
                FlowDirection = FlowDirection.LeftToRight
            };

            IViewController controller = layout;

            Assume.That(controller.EffectiveFlowDirection.IsExplicit(), "Explicit LTR view EffectiveFlowDirection should be Explicit");
            Assume.That(controller.EffectiveFlowDirection.IsLeftToRight(), "Explicit LTR view EffectiveFlowDirection should be LeftToRight");
            Assume.That(layout.FlowDirection == FlowDirection.LeftToRight, "Explicit LTR view FlowDirection should be LeftToRight");
            return(layout);
        }
예제 #41
0
 public MainView(
     IViewController controller,
     IServiceProvider serviceProvider,
     ILog log,
     iRacingTelemetryOptions options)
     : base(
         controller,
         serviceProvider,
         log,
         options)
 {
     InitializeComponent();
 }
예제 #42
0
    void Awake() {
        //Check if instance already exists
        if (instance == null)

            //if not, set instance to this
            instance = this;

        //If instance already exists and it's not this:
        else if (instance != this)

            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Use the login controller to handle message passing to the server
        Controller = new NetworkController(this);
    }
        public MainWindowViewModel(IViewController views, ChatClient client, ConnectionManager connection, Dispatcher dispatcher)
        {
            this.views = views;
            this.client = client;
            this.connection = connection;
            this.dispatcher = dispatcher;

            ChangeNameCommand = new RelayCommand(_ => ChangeName());
            ChangeFontCommand = new RelayCommand(_ => ChangeFont());
            ChangeStatusCommand = new RelayCommand(_ => ChangeStatus(_ as string), _ => CanChangeStatus(_ as string));
            CloseChatCommand = new RelayCommand(_ => CloseConversation(_ as ConversationViewModel));
            LogoutCommand = new RelayCommand(_ => LogOut());
            QuitCommand = new RelayCommand(_ => Quit());
            ViewEmotesCommand = new RelayCommand(_ => ViewEmotes());

            stateDetector = new UserStateDetector();
            stateDetector.IdleTimeThreshold = 60 * 5; // 5 minutes
            stateDetector.IsIdleEnabled = true;
            stateDetector.IsBusyEnabled = true;
            stateDetector.UserIdleChanged += OnUserIdleChanged;
            stateDetector.UserBusyChanged += OnUserBusyChanged;

            client.StreamError += OnStreamError;
            me = new UserViewModel(client, client.Me);
            conversations = new ConversationManager(client);
            conversations.NewConversation += OnNewConversation;

            openTabsView = new ListCollectionView(openTabs);
            openTabsView.CurrentChanged += OnCurrentTabChanged;

            var newTabVM = new NewTabViewModel(client);
            newTabVM.StartChat += OnStartChat;
            openTabs.Add(newTabVM);

            tabHighlightTimer.Elapsed += OnTabHighlight;

            client.ListFriends();
            client.ListGroups();
        }
        /// <summary>
        /// To extract driver and claimant from nameinvolvement list(other related parties) 
        /// </summary>
        /// <param name="controller">Claim Controller</param>
        /// <param name="context">Context for binding</param>
        public void SetRenderContext(IViewController controller, object context)
        {
            ClaimModel claimModel = (ClaimModel)controller.Model;
            claimModel.NameInvolvementModel.CanAddProductClaimNI = true;
            claimModel.NameInvolvementModel.ProductClaimNameInvolvementTypeForFilter = null;
            claimModel.NameInvolvementModel.ProductClaimNameNameUsageTypeCodeForFilter = string.Empty;
            List<ClaimNameInvolvementDto> claimnameinvolvementdtos = new List<ClaimNameInvolvementDto>();
            foreach (ClaimNameInvolvementDto claimnameinvolvementdto in claimModel.NameInvolvementModel.ClaimNameInvolvementDtos)
            {
                if (claimnameinvolvementdto.ClaimNameInvolvementData.NameInvolvementType != (short)StaticValues.NameInvolvementType.AdditionalClaimant && claimnameinvolvementdto.ClaimNameInvolvementData.NameInvolvementType != (short)StaticValues.NameInvolvementType.Driver)
                {
                    if (claimnameinvolvementdto.ClaimNameInvolvementData.NameInvolvementMaintenanceStatus == (short)StaticValues.ClaimNameInvolvementMaintenanceStatus.Latest)
                    {
                        claimnameinvolvementdtos.Add(claimnameinvolvementdto);
                    }
                }
            }

            var claimControllerBase = (IClaimControllerBase)controller;
            claimControllerBase.FillClaimNameInvolvementsList(claimnameinvolvementdtos);
            claimModel.NameInvolvementModel.SelectedClaimNameInvolvementData = null;
            claimModel.NameInvolvementModel.SelectedClaimNameInvolvementRow = null;
        }
 public Form3PPNTPlotInfo(IViewController viewController)
 {
     InitializeComponent();
 }
        public TreeVM UserAddTree(IViewController viewController)
        {
            TreeVM templateTree = null;
            StratumModel stratum = null;
            SampleGroupModel samplegroup = null;
            TreeDefaultValueDO tdv = null;
            if (NonPlotTrees.Count > 0)
            {
                templateTree = NonPlotTrees[NonPlotTrees.Count - 1];
                if (templateTree != null)
                {
                    stratum = templateTree.Stratum;
                    samplegroup = templateTree.SampleGroup;
                    tdv = templateTree.TreeDefaultValue;
                }
            }
            else if (DefaultStratum != null)
            {
                stratum = this.DefaultStratum;

                //var samplegroups = DAL.From<SampleGroupModel>()
                //    .Where("Stratum_CN = ?")
                //    .Read(stratum.Stratum_CN).ToList();
                if (stratum.SampleGroups != null
                    && stratum.SampleGroups.Count == 1)
                {
                    samplegroup = stratum.SampleGroups[0];
                }
            }

            var newTree = this.CreateNewTreeEntry(stratum
                , samplegroup, tdv, true);
            newTree.TreeCount = 0; //user added trees need a tree count of zero because users seem to be adding counts through tally settings

            viewController.ShowCruiserSelection(newTree);

            newTree.TrySave();
            this.AddNonPlotTree(newTree);

            return newTree;
        }
예제 #47
0
 public ViewNavigatorBase(IViewController controller): this()
 {
     ViewController = controller;
 }
 public void RegisterToControlFixedViews(IViewController viewController)
 {
     if (this.registeredFixedViewsUIOControllers != null)
     {
         if (!this.registeredFixedViewsUIOControllers.Contains(viewController))
         {
             this.registeredFixedViewsUIOControllers.Add(viewController);
         }
     }
 }
예제 #49
0
 public override void Awake()
 {
     Controller = new LoginController(this);
     PhotonEngine.UseExistingOrCreateNewPhotonEngine(ServerAddress, ApplicationName);
 }
예제 #50
0
        public Runner(ISourceMonitor sourceMonitor, IViewController viewController, IViewGenerator viewGenerator)
        {
            SourceMonitor = sourceMonitor;
            ViewController = viewController;
            ViewGenerator = viewGenerator;

            SourceMonitor.SourceChanged += SourceMonitor_SourceChanged;
        }
예제 #51
0
 void Awake()
 {
     Controller = new CharacterCreateController(this);
 }
 public void RegisterToControlDynamicViews(IViewController viewController)
 {
     if (this.registeredDynamicViewsUIControllers !=null)
     {
         if (!this.registeredDynamicViewsUIControllers.Contains(viewController))
         {
             this.registeredDynamicViewsUIControllers.Add(viewController);
         }
     }
 }
예제 #53
0
 public virtual void Awake()
 {
     Controller = new ViewController(this);
 }
예제 #54
0
 void Awake()
 {
     Controller = new LoginController(this);
 }
예제 #55
0
 public LoginDialog(IViewController views)
     : this(views, true)
 {
 }
 public ForwardsClosingViewNavigator(IViewController controller) : base(controller) 
 {
     ClosedForwards = delegate { };
 }
예제 #57
0
        public TreeVM UserAddTree(TreeVM templateTree, IViewController viewController)
        {
            TreeVM newTree;
            SampleGroupModel assumedSG = null;
            TreeDefaultValueDO assumedTDV = null;

            if (templateTree != null)
            {
                assumedSG = templateTree.SampleGroup; ;
                assumedTDV = templateTree.TreeDefaultValue;
            }

            //extrapolate sample group
            if (assumedSG == null)//if we have a stratum but no sample group, pick the first one
            {
                List<SampleGroupModel> samplegroups = this.DAL.From<SampleGroupModel>()
                    .Where("Stratum_CN = ?")
                    .Read(this.Stratum.Stratum_CN).ToList();
                if (samplegroups.Count == 1)
                {
                    assumedSG = samplegroups[0];
                }
            }

            newTree = this.CreateNewTreeEntry(assumedSG, assumedTDV, true);

            viewController.ShowCruiserSelection(newTree);

            //if a 3P plot method set Count Measure to empty.
            if (Array.IndexOf(CruiseDAL.Schema.CruiseMethods.THREE_P_METHODS,
                this.Stratum.Method) >= 0)
            {
                newTree.CountOrMeasure = string.Empty;
            }

            newTree.TreeCount = 1; //user added trees need a tree count of one because they aren't being tallied
            newTree.TrySave();
            this.AddTree(newTree);

            return newTree;
        }