private void InitTitleBlocks() { int idx = 0; TitleBlockList = new ObservableCollection <string>(); TitleBlockList.Clear(); TitleBlockList.Add(AppStrings.R_TBlkNone); if (_DBMgr.SheetCount > 0) { TitleBlockList.Add(AppStrings.R_TBlkFromSelSheet); } if (_DBMgr.TitleBlockCount > 0) { idx++; foreach (FamilySymbol tb in _DBMgr.GetAllTitleBlocks()) { TitleBlockList.Add(ShDbMgr.FormatTitleBlockName(tb)); } } cbxTitleBlock.SelectedIndex = idx; OnPropertyChange("TitleBlockList"); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { _uiapp = commandData.Application; _uidoc = _uiapp.ActiveUIDocument; _document = _uidoc.Document; _DBMgr = new ShDbMgr(commandData); string TransactionDesc = AppStrings.R_ButtonNameTop + " " + AppStrings.R_ButtonNameBott; if (_DBMgr.SheetCount > 0) { // determine if we can proceed using (Transaction tx = new Transaction(_document)) { tx.Start(TransactionDesc); WpfSelViewSheetWin = new WpfSelViewSheet(commandData); // AppStrings.Culture = new CultureInfo("fr"); // Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr"); // this works // Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr"); // Debug.WriteLine("hello? " + AppStrings.Hello); try { if ((WpfSelViewSheetWin.ShowDialog() ?? false) == false) { // user canceled the operation - return canceled result tx.Dispose(); return(Result.Cancelled); } tx.Commit(); } catch (Exception e) { tx.Dispose(); ShUtil.ShowExceptionDialog(e, USet.Basic, _DBMgr.ParentLeft, _DBMgr.ParentTop); return(Result.Cancelled); } } } else { ShUtil.ShowErrorDialog(AppStrings.R_ErrNoSheetsTitle, AppStrings.R_ErrNoSheetsMainMsg_DupShts, AppStrings.R_ErrNoSheetsContent); return(Result.Failed); } return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { _uiapp = commandData.Application; UIDocument _uidoc = _uiapp.ActiveUIDocument; Document _document = _uidoc.Document; _DBMgr = new ShDbMgr(commandData); string TransactionDesc = AppStrings.R_ButtonNameTop + " " + AppStrings.R_ButtonNameBott; if (_DBMgr.SheetCount > 0) { using (Transaction tx = new Transaction(_document)) { tx.Start(TransactionDesc); OneClick oneClick = new OneClick(); try { if (!oneClick.Process(commandData)) { tx.Dispose(); return(Result.Failed); } tx.Commit(); } catch (Exception e) { tx.Dispose(); ShUtil.ShowExceptionDialog(e, USet.OneClick, _DBMgr.ParentLeft, _DBMgr.ParentTop); return(Result.Failed); } } } else { ShUtil.ShowErrorDialog(AppStrings.R_ErrNoSheetsTitle, AppStrings.R_ErrNoSheetsMainMsg_OneClick, AppStrings.R_ErrNoSheetsContent); return(Result.Failed); } return(Result.Succeeded); }
// fill in the combo box with the list of title blocks // along with the one or two special options private void SetupTitleBlockList() { int offset = 0; intFromSheetIdx = -1; // intFirstTbIdx = -1; // add the 2 special options // option 1: no title block cbxTitleBlocks.Items.Add(NOTITLEBLOCK); // option 2: currently selected sheet // we have some sheets - list that as an option if (_DBMgr.SheetCount > 0) { offset++; intFromSheetIdx = offset; cbxTitleBlocks.Items.Add(SHEETTITLEBLOCK); } // got title blocks to add to the list? if (_DBMgr.TitleBlockCount > 0) { offset++; // intFirstTbIdx = offset; // fill-in the list of titleblocks foreach (FamilySymbol fs in _DBMgr.GetAllTitleBlocks()) { cbxTitleBlocks.Items.Add(ShDbMgr.FormatTitleBlockName(fs)); } } // pre-select the first item in the list // which may be the only item cbxTitleBlocks.SelectedIndex = 0 + offset; //return true; }
public FormSelViewSheet(ExternalCommandData commandData) { _DBMgr = new ShDbMgr(commandData); // Debug.Print("********** Initializing Form **********"); InitializeComponent(); // pre-select the sheet number format combo box cbxShtNumFormat.SelectedIndex = 1; tbNewViewDivChars.Text = FMTVIEWNAME_DIVIDESTRING; tbNewViewGroupCharsLeft.Text = FMTVIEWNAME_SURROUNDSTRING_LEFT; tbNewViewGroupCharsRight.Text = FMTVIEWNAME_SURROUNDSTRING_RIGHT; tbDate.Text = File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location).ToString("G"); cxbAddSpaces.Checked = true; rbNewViewNoAddedChars.Checked = true; SetNewViewNameFmtOpts(); }