コード例 #1
0
        private void SetCoordinateSystemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var menuItem    = sender as ToolStripMenuItem;
            var menuContext = menuItem.GetCurrentParent() as ContextMenuStrip;
            GeoDataGridViewModel currentModel = getContextMenuGeoDataGridViewModel(menuContext);

            if (currentModel != null)
            {
                var confirmText = String.Format("「{0}」 將設為參考座標?", currentModel.Name);
                var confirmed   = MessageBox.Show(confirmText, "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes;
                if (confirmed)
                {
                    var isExists = _dfCoordinateBindingList.Any(p => p.ID == currentModel.RecordID);
                    if (!isExists)
                    {
                        var nwCoordinate = new RefCoordinate()
                        {
                            ID   = currentModel.RecordID,
                            Desc = "",
                            Name = currentModel.Name,
                        };
                        _dfCoordinateBindingList.Add(nwCoordinate);
                        CoordinateComboBox.SelectedItem = nwCoordinate;
                    }
                }
            }
        }
コード例 #2
0
        private void restoreToDefaultCoordinate()
        {
            var model = new RefCoordinate()
            {
                ID = "", Name = "Default", Desc = "影像座標"
            };

            _dfCoordinateBindingList.Clear();
            _dfCoordinateBindingList.Add(model);
            BindingSource ds = new BindingSource()
            {
                DataSource = _dfCoordinateBindingList
            };

            CoordinateComboBox.ComboBox.DataSource = ds;
        }