コード例 #1
0
        private bool ConfigureCallback(object context)
        {
            bool result = false;

            string oldTypeName;

            if (string.IsNullOrEmpty(((CslaDataSource)DataSourceControl).TypeAssemblyName))
            {
                oldTypeName = ((CslaDataSource)DataSourceControl).TypeName;
            }
            else
            {
                oldTypeName = string.Format("{0}, {1}",
                                            ((CslaDataSource)DataSourceControl).TypeName, ((CslaDataSource)DataSourceControl).TypeAssemblyName);
            }

            IUIService uiService            = (IUIService)_control.Site.GetService(typeof(IUIService));
            CslaDataSourceConfiguration cfg = new CslaDataSourceConfiguration(_control, oldTypeName);

            if (uiService.ShowDialog(cfg) == System.Windows.Forms.DialogResult.OK)
            {
                SuppressDataSourceEvents();
                try
                {
                    ((CslaDataSource)DataSourceControl).TypeAssemblyName = string.Empty;
                    ((CslaDataSource)DataSourceControl).TypeName         = cfg.TypeName;
                    OnDataSourceChanged(EventArgs.Empty);
                    result = true;
                }
                finally
                {
                    ResumeDataSourceEvents();
                }
            }
            cfg.Dispose();
            return(result);
        }
コード例 #2
0
    private bool ConfigureCallback(object context)
    {
      bool result = false;

      string oldTypeName;
      if (string.IsNullOrEmpty(((CslaDataSource)DataSourceControl).TypeAssemblyName))
        oldTypeName = ((CslaDataSource)DataSourceControl).TypeName;
      else
        oldTypeName = string.Format("{0}, {1}", 
          ((CslaDataSource)DataSourceControl).TypeName, ((CslaDataSource)DataSourceControl).TypeAssemblyName);

      IUIService uiService = (IUIService)_control.Site.GetService(typeof(IUIService));
      CslaDataSourceConfiguration cfg = new CslaDataSourceConfiguration(_control, oldTypeName);
      if (uiService.ShowDialog(cfg) == System.Windows.Forms.DialogResult.OK)
      {
        SuppressDataSourceEvents();
        try
        {
          ((CslaDataSource)DataSourceControl).TypeAssemblyName = string.Empty;
          ((CslaDataSource)DataSourceControl).TypeName = cfg.TypeName;
          OnDataSourceChanged(EventArgs.Empty);
          result = true;
        }
        finally
        {
          ResumeDataSourceEvents();
        }
      }
      cfg.Dispose();
      return result;
    }