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;
        }
        public DialogResult ShowDialog(PlotVM plot, PlotStratum stratum, bool allowEdit)
        {
            _plot = plot as Plot3PPNT;
            _BS_plot.DataSource = _plot;
            _stratum = stratum;

            this.DialogResult = DialogResult.OK;

            this._kz3ppnt_lbl.Text = stratum.KZ3PPNT.ToString();

            return this.ShowDialog();
        }
        public LayoutPlot(FormDataEntryLogic dataEntryController, Control parent, PlotStratum stratum)
        {
            Stratum = stratum;
            this.ViewLogicController = new LayoutPlotLogic(stratum, this, dataEntryController, dataEntryController.ViewController);
            this.Dock = DockStyle.Fill;
            InitializeComponent();

            WireSplitter(stratum);

            this.bindingNavigatorAddNewItem.Click += new System.EventHandler(this._addPlotButton_Click);
            this.bindingNavigatorDeleteItem.Click += new System.EventHandler(this._deletePlotButton_Click);
            this._plotInfoBTN.Click += new System.EventHandler(this._plotInfoBTN_Click);

            InitializeDataGrid(stratum);

            //no need to load tallies....?
            //Controller.PopulateTallies(this.StratumInfo, this._mode, Controller.CurrentUnit, this._tallyListPanel, this);
            this.Parent = parent;
        }
 void WireSplitter(PlotStratum stratum)
 {
     if (stratum.Is3PPNT == false)
     {
         LayoutPlot.SplitterMoved += new SplitterMovedEventHandler(LayoutPlot_SplitterMoved);
         this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.HandleSplitterMoved);
     }
     else
     {
         this.splitContainer1.Panel1Collapsed = true;
     }
 }
        void InitializeTallyPanel(PlotStratum stratum)
        {
            _tallyListPanel.SuspendLayout();

            if (stratum is FixCNTStratum)
            {
                var openFixCNTTallyButton = new Button()
                {
                    Text = "Open Tally Screen"
                    ,
                    Dock = DockStyle.Top
                };
                openFixCNTTallyButton.Click += new EventHandler(openFixCNTTallyButton_Click);
                this._tallyListPanel.Controls.Add(openFixCNTTallyButton);
            }
            else if (stratum.IsSingleStage)
            {
                if (stratum.Method == "3PPNT")
                {
                    //no need to initialize any counts or samplegroup info for 3PPNT
                    IsGridExpanded = false;
                }
                else if (stratum.Counts.Count() > 0)
                {
                    foreach (CountTreeVM count in stratum.Counts)
                    {
                        MakeTallyRow(_tallyListPanel, count);
                    }
                }
                else
                {
                    MakeSGList(stratum.SampleGroups, _tallyListPanel);
                }
            }
            else
            {
                foreach (CountTreeVM count in stratum.Counts)
                {
                    MakeTallyRow(_tallyListPanel, count);
                }
            }

            this._tallyListPanel.ResumeLayout();
        }
        void InitializeDataGrid(PlotStratum stratum)
        {
            this._dataGrid.CellClick += new DataGridViewCellEventHandler(_dataGrid_CellClick);
            this._dataGrid.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this._dataGrid_CellValidating);
            this._dataGrid.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this._dataGrid_DataError);
            this._dataGrid.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this._datagrid_CellEnter);

            this._dataGrid.AutoGenerateColumns = false;

            this._dataGrid.SuspendLayout();
            var columns = stratum.MakeTreeColumns();
            this._dataGrid.Columns.AddRange(columns.ToArray());
            this._dataGrid.ResumeLayout();

            _speciesColumn = _dataGrid.Columns["TreeDefaultValue"] as DataGridViewComboBoxColumn;
            _sgColumn = _dataGrid.Columns["SampleGroup"] as DataGridViewComboBoxColumn;
            _treeNumberColumn = _dataGrid.Columns["TreeNumber"] as DataGridViewTextBoxColumn;
            _initialsColoumn = _dataGrid.Columns["Initials"] as DataGridViewComboBoxColumn;
            _errorMessageColumn = _dataGrid.Columns["Error"] as DataGridViewTextBoxColumn;
            _logsColumn = _dataGrid.Columns["Logs"] as DataGridViewButtonColumn;
            _stColumn = _dataGrid.Columns["Stratum"] as DataGridViewComboBoxColumn;

            if (_speciesColumn != null)
            {
                _speciesColumn.DataSource = AppController._cDal.From<TreeDefaultValueDO>().Read().ToList();
            }
            if (_sgColumn != null)
            {
                _sgColumn.DataSource = stratum.SampleGroups;
            }
            if (_initialsColoumn != null)
            {
                _initialsColoumn.DataSource = this.AppController.Settings.Cruisers.ToArray();
            }
            if (_logsColumn != null)
            {
                _logsColumn.Visible = AppController.ViewController.EnableLogGrading;
            }
            if (_stColumn != null)
            {
                _stColumn.DataSource = new PlotStratum[] { this.Stratum };
            }
        }
 public System.Windows.Forms.DialogResult ShowPlotInfo(PlotVM plotInfo, PlotStratum stratum, bool allowEdit)
 {
     throw new NotImplementedException();
 }
        //public int? ShowNumericValueInput(int? min, int? max, int? initialValue, bool acceptNullInput)
        //{
        //    this.NumPadDialog.ShowDialog(min, max, initialValue, acceptNullInput);
        //    return this.NumPadDialog.UserEnteredValue;
        //}
        public DialogResult ShowPlotInfo(PlotVM plot, PlotStratum stratum, bool isNewPlot)
        {
            System.Diagnostics.Debug.Assert(plot != null);
            System.Diagnostics.Debug.Assert(stratum != null);

            if (stratum.Is3PPNT && isNewPlot)
            {
                using (var view = new Form3PPNTPlotInfo(this))
                {
            #if !NetCF
                    view.Owner = this._dataEntryView;
                    view.StartPosition = FormStartPosition.CenterParent;
            #endif
                    return view.ShowDialog(plot, stratum, isNewPlot);
                }
            }
            else
            {
                using (var view = new FormPlotInfo())
                {
            #if !NetCF
                    view.Owner = this._dataEntryView;
                    view.StartPosition = FormStartPosition.CenterParent;
            #endif
                    return view.ShowDialog(plot, stratum, isNewPlot);
                }
            }
        }
        private void _plotInfo_BTN_Click(object sender, EventArgs e)
        {
            var stratum = new PlotStratum();
            var plot = new PlotVM() { Stratum = stratum };

            using (var view = new FormPlotInfo())
            {
                view.ShowDialog(plot, stratum, false);
            }
        }
        public LayoutPlot(FormDataEntryLogic dataEntryController, Control parent, PlotStratum stratum, InputPanel sip)
        {
            Stratum = stratum;
            this.ViewLogicController = new LayoutPlotLogic(stratum, this, dataEntryController, dataEntryController.ViewController);

            InitializeComponent();
            InitializePlotNavIcons();

            //Setup Plot Nav Bar
            this._addPlotButton.Text = "+";
            this._deletePlotButton.Text = "-";
            this._plotInfoButton.Text = "i";
            this._expandGridButton.ImageIndex = 0;
            this._expandGridButton.ButtonImageLayout = ImageLayout.Tile;
            this._nextPlotButton.ButtonImageLayout = ImageLayout.Zoom;
            this._gotoLastPlotButton.ButtonImageLayout = ImageLayout.Zoom;
            this._prevPlotButton.ButtonImageLayout = ImageLayout.Zoom;
            this._gotoFirstPlotButton.ButtonImageLayout = ImageLayout.Zoom;

            if (ViewController.PlatformType == PlatformType.WinCE)
            {
                this._expandGridButton.Font = new System.Drawing.Font("Arial", this._expandGridButton.Font.Size, this._expandGridButton.Font.Style);
                this._gotoFirstPlotButton.Font = new System.Drawing.Font("Arial", this._gotoFirstPlotButton.Font.Size, this._gotoFirstPlotButton.Font.Style);
                this._gotoLastPlotButton.Font = new System.Drawing.Font("Arial", this._gotoLastPlotButton.Font.Size, this._gotoLastPlotButton.Font.Style);
                this._nextPlotButton.Font = new System.Drawing.Font("Arial", this._nextPlotButton.Font.Size, this._nextPlotButton.Font.Style);
                this._prevPlotButton.Font = new System.Drawing.Font("Arial", this._prevPlotButton.Font.Size, this._prevPlotButton.Font.Style);
            }

            //Setup DataGrid
            DataGridAdjuster.InitializeGrid(this._dataGrid);
            _tableStyle = stratum.InitializeTreeColumns(_dataGrid);
            this._dataGrid.SIP = sip;
            this._dataGrid.CellValidating += new EditableDataGridCellValidatingEventHandler(_dataGrid_CellValidating);
            this._dataGrid.CellValueChanged += new EditableDataGridCellValueChangedEventHandler(this._dataGrid_CellValueChanged);
            //this._dataGrid.DataSource = typeof(FSCruiserV2.Logic.TreeVM);//_BS_Trees;
            this._dataGrid.Click += new EventHandler(_dataGrid_Click);
            this._dataGrid.ReadOnly = true;
            this._dataGrid.AllowUserToAddRows = false;

            _speciesColumn = _tableStyle.GridColumnStyles["TreeDefaultValue"] as EditableComboBoxColumn;
            _sgColumn = _tableStyle.GridColumnStyles["SampleGroup"] as EditableComboBoxColumn;
            _treeNumberColumn = _tableStyle.GridColumnStyles["TreeNumber"] as EditableTextBoxColumn;
            _initialsColoumn = _tableStyle.GridColumnStyles["Initials"] as EditableComboBoxColumn;
            _logsColumn = _tableStyle.GridColumnStyles["LogCountActual"] as DataGridButtonColumn;
            _kpiColumn = _tableStyle.GridColumnStyles["KPI"] as EditableTextBoxColumn;
            _errorsColumn = _tableStyle.GridColumnStyles["Error"] as DataGridTextBoxColumn;

            if (_logsColumn != null)
            {
                _logsColumn.Click += this.LogsClicked;
            }

            HandleCruisersChanged();

            this.Dock = DockStyle.Fill;
            this.Parent = parent;

            InitializeTallyPanel();

            this.ViewLogicController.UpdateCurrentPlot();
        }