Esempio n. 1
0
 public void Select2(ServerDbs tabName, Database.Tuple tuple)
 {
     if (tuple.Attributes.PrimaryAttribute.DataType == typeof(int))
     {
         SelectInternal(tabName, new List <int> {
             tuple.GetKey <int>()
         });
     }
     else if (tuple.Attributes.PrimaryAttribute.DataType == typeof(string))
     {
         SelectInternal(tabName, new List <string> {
             tuple.GetKey <string>()
         });
     }
 }
Esempio n. 2
0
        public AddRangeDialog(SdeEditor editor)
            : base("Add range...", "add.png", SizeToContent.WidthAndHeight, ResizeMode.NoResize)
        {
            InitializeComponent();

            _tab = editor.FindTopmostTab();

            if (_tab == null)
            {
                throw new Exception("No table selected.");
            }

            if (!(_tab is GDbTabWrapper <int, ReadableTuple <int> >))
            {
                throw new Exception("This table doesn't support this operation.");
            }

            List <ServerDbs> dbSources = new List <ServerDbs>();

            dbSources.Add(_tab.DbComponent.DbSource);

            if (_tab.DbComponent.DbSource.AdditionalTable != null)
            {
                dbSources.Add(_tab.DbComponent.DbSource.AdditionalTable);
            }

            _destTable.ItemsSource   = dbSources;
            _destTable.SelectedIndex = 0;

            WpfUtils.AddMouseInOutEffects(_imReset);

            this.Loaded += delegate {
                _tbRange.Text = "1";
                _tbFrom.Text  = "0";

                if (_tab._listView.SelectedItem != null)
                {
                    _based              = (Tuple)_tab._listView.SelectedItem;
                    _tbBasedOn.Text     = _based.GetKey <int>().ToString(CultureInfo.InvariantCulture);
                    _imReset.Visibility = System.Windows.Visibility.Visible;

                    _tbFrom.Text = (_based.GetKey <int>() + 1).ToString(CultureInfo.InvariantCulture);
                }
            };

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            Owner = WpfUtilities.TopWindow;
        }