private void lBox_labels_select_Click(object sender, RoutedEventArgs e) { try { //check if the uesr in paper space if so swithc to model space Helper.ViewportExtensions.toggleModelspace(); GV.selLabels = new ObjectIdCollection(); if (listView_styleComponentMapper.SelectedItems.Count > 0) { foreach (Global.labelComponentItem item in listView_styleComponentMapper.SelectedItems) { GV.selLabels.Add(item.objID); } ObjectId[] ids = new ObjectId[listView_styleComponentMapper.SelectedItems.Count]; GV.selLabels.CopyTo(ids, 0); Utils.SelectObjects(ids); LCH.ZoomObjects(GV.selLabels); } } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void btn_browse_mapperFile_Click(object sender, RoutedEventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Mapper XML files (*.XMLMapper)|*.XMLMapper|CSV Mapper (*.CSVMapper1)|*.CSVMapper1"; // "Mapper files (*.Mapper)|*.map"; ofd.RestoreDirectory = true; DialogResult sdResult = ofd.ShowDialog(); foreach (string file in ofd.FileNames) { //extract the data from the selected file. GH.getFileObject(file, "mapper"); } //set that file to the combobox cBox_Mapper.SelectedIndex = cBox_Mapper.Items.Count - 1; C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_Mapper.SelectedItem; GH.getMapper(FI.filePath); //set that file to the combobox UIH.toastIT("Mapper files read sucessfully!", "File Read", NotificationType.Information); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void lBox_labels_zoomto_Click(object sender, RoutedEventArgs e) { try { //check if the uesr in paper space if so swithc to model space Helper.ViewportExtensions.toggleModelspace(); //MessageBox.Show("lBox_labels_zoomto_Click"); GV.selLabels = new ObjectIdCollection(); if (listView_styleComponentMapper.SelectedItems.Count > 0) { List<Global.labelComponentItem> selectedItems = listView_styleComponentMapper.SelectedItems.Cast<Global.labelComponentItem>().ToList(); if (selectedItems[0].objID.ObjectClass.DxfName.ToString() == "MULTILEADER") { selectedItems = selectedItems.Reverse<Global.labelComponentItem>().Reverse().ToList(); } foreach (Global.labelComponentItem item in listView_styleComponentMapper.SelectedItems) { GV.selLabels.Add(item.objID); } LCH.ZoomObjects(GV.selLabels); } } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void lBox_labels_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
public void updateObjectType() { try { } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void Btn_addStyle_Click(object sender, RoutedEventArgs e) { try { //load the current item if (selObjs.Where(item => item.styleName == tBox_styleName.Text).Any() == true) { LI = selObjs.Where(item => item.styleName == tBox_styleName.Text).Single(); } //check if that object already exists if (GV.labelComponentItem_coll.Where(LabelItem => LabelItem.styleName == LI.styleName).Any() == false) { //check if all the values are filled in if (tBox_styleName.Text == string.Empty) { Blink(true, "Style name missing, please enter"); } //else if (tBox_styleKNloc.Text == string.Empty) //{ // Blink(true, "Style KN location missing, please enter"); //} else if (cBox_styleType.Text == string.Empty) { Blink(true, "Style type missing, please enter"); } else { //user approval LI.labelType = cBox_styleType.Text; LI.learnStatus = true; GV.labelComponentItem_coll.Add(LI); //if note type note in the list then add to the list and the file addNoteType(); if (selObjs.Where(item => item.styleName == LI.styleName).Any() == true) { selObjs.Remove(selObjs.Where(item => item.styleName == LI.styleName).Single()); } //check if next item exsits if so move or else close moveOrClose(); Blink(false, ""); } } else // item already exists { Blink(true, "Style already exists!"); moveOrClose(); } } catch (System.Exception ex) { GH.writeLog(ex.ToString()); } }
private void btn_fetchSelectedtamplateFile_Click(object sender, RoutedEventArgs e) { try { C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_template.SelectedItem; GH.getTemplateDetails(FI.filePath); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void cBox_template_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_template.SelectedItem; GH.getTemplateDetails(FI.filePath); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
public AAPro() { try { InitializeComponent(); GV.labelComponentItem_coll.Clear(); listView_styleComponentMapper.ItemsSource = GV.labelComponentItem_coll; cBox_styleType.ItemsSource = GV.noteTypeListColl; } catch (System.Exception ex) { GH.writeLog(ex.ToString()); } }
private void btn_open_templateFile_Click(object sender, RoutedEventArgs e) { try { C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_template.SelectedItem; Process.Start("notepad.exe", FI.filePath); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void btn_fetchSelectedmapperFiles_Click(object sender, RoutedEventArgs e) { try { C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_Mapper.SelectedItem; GH.getMapper(FI.filePath); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
public void clearUIValues() { try { lbl_statusCount.Content = ""; cBox_objectType.ItemsSource = null; lBox_CurrentNotes.ItemsSource = null; } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
public void SetProgress(double val, double Max, string statusCount) { try { GH.writeLog("Progress: " + val + " | " + Max + " | " + statusCount); lbl_statusCount.Content = statusCount; proBar.Value = ((val / Max) * 100); } catch (System.Exception ex) { GH.writeLog("SetProgress : " + ex.ToString()); } }
private void cBox_Mapper_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_Mapper.SelectedItem; GH.qprint("Selected Mapper File: " + FI.filePath); GH.getMapper(FI.filePath); updateUIdata(); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void btn_fetchtamplateFile_Click(object sender, RoutedEventArgs e) { try { int index = cBox_template.SelectedIndex; GH.getFiles("template"); cBox_template.SelectedIndex = index; UIH.toastIT("Defnition files read sucessfully!", "File Read", NotificationType.Information); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void btn_saveAS_styleStructureFile_Click(object sender, RoutedEventArgs e) { try { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Style Structure File (*.sst)|*.sst"; if (saveFileDialog.ShowDialog() == true) { tBox_stylemapperFile.Text = saveFileDialog.FileName; writetoFile(); } } catch (System.Exception ex) { GH.writeLog(ex.ToString()); } }
public void UpdateProgressBar(double val, double Max, string statusCount) { try { // Action is delegate (means a function pointer) which is Pointing towards "SetProgress" method Action action = () => { SetProgress(val, Max, statusCount); }; //proBar.Dispatcher.BeginInvoke(action); proBar.Dispatcher.BeginInvoke(action); //proBar.Dispatcher.Invoke(() => action, DispatcherPriority.Background); //listBox_status.Dispatcher.BeginInvoke(action); } catch (System.Exception ex) { GH.writeLog("SetProgress : " + ex.ToString()); } }
public void bw_UpdateProgressBar(object sender, DoWorkEventArgs e) { try { BackgroundWorker worker = sender as BackgroundWorker; UpdateProgressBar(GV.pBarCurrentVal, GV.pBarMaxVal, GV.pBarStatus); //lbl_statusCount.Content = GV.pBarStatus; //proBar.Value = ((GV.pBarCurrentVal / GV.pBarMaxVal) * 100); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { GH.writeLog(ex.ToString()); } catch (System.Exception ex) { GH.writeLog(ex.ToString()); } }
public void fetchDATA() { try { cBox_template.ItemsSource = GV.templateFiles; cBox_template.SelectedIndex = 0; cBox_Mapper.ItemsSource = GV.mapperFiles; cBox_Mapper.SelectedIndex = 0; cBox_objectType.ItemsSource = GV.ObtTypes; //cBox_objectType.SelectedIndex = 0; //set window title } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
public void updateUIdata() { try { cBox_objectType.ItemsSource = null; lBox_CurrentNotes.ItemsSource = null; cBox_objectType.ItemsSource = GV.NotesCollection_Anno2.Keys; //if more than one objectype present in the cbox then display that if (cBox_objectType.Items.Count > 0) { cBox_objectType.SelectedIndex = 0; } //add notes to list view lBox_CurrentNotes.ItemsSource = GV.NotesCollection_Anno2[cBox_objectType.SelectedItem.ToString()]; } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void writetoFile() { try { //save the mapping information in XML format to the style mapper file. //update the existing file. //this will erase whats on the file and update with the current view content. Dictionary<string, Dictionary<string, string>> Item = new Dictionary<string, Dictionary<string, string>>(); Dictionary<string, string> keyvalue = new Dictionary<string, string>(); string CSVstring = ""; foreach (Global.labelComponentItem item in GV.labelComponentItem_coll) { string KNValue = String.Join(",", item.KNComponentID.Select(n => n.ToString()).ToArray()); keyvalue.Add(item.labelType, KNValue); Item.Add(item.styleName, keyvalue); CSVstring += item.styleName + GV.SSTfileDelimiter + item.labelType + GV.SSTfileDelimiter + KNValue + Environment.NewLine; } if (GV.SSTfileFormat == "XML") { VSharpXMLHelper.xmlWriter.cleanWritevariableKey(tBox_stylemapperFile.Text, "APP", "type", Item); //check if a file selected } else //native format { if (!File.Exists(tBox_stylemapperFile.Text)) { File.Create(tBox_stylemapperFile.Text).Close(); } File.WriteAllText(tBox_stylemapperFile.Text, CSVstring); } } catch (System.Exception ex) { GH.writeLog(ex.ToString()); } }
private void btn_browse_templateFile_Click(object sender, RoutedEventArgs e) { try { // Create an instance of the open file dialog box. OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Note list XML files (*.XMLNotes)|*.XMLNotes|CSV Notes without double quotes (*.CSVNotes1)|*.CSVNotes1|CSV Notes with double quotes (*.CSVNotes2)|*.CSVNotes2"; //"XML files (*.xml)|*.def"; ofd.RestoreDirectory = true; DialogResult sdResult = ofd.ShowDialog(); if (sdResult != System.Windows.Forms.DialogResult.OK) { return; } foreach (string file in ofd.FileNames) { //if the file dont exits add //extract the data from the selected file. GH.getFileObject(file, "template"); } //set that file to the combobox cBox_template.SelectedIndex = cBox_template.Items.Count - 1; C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_template.SelectedItem; GH.getTemplateDetails(FI.filePath); UIH.toastIT("Note list files read sucessfully!", "File Read", NotificationType.Information); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
public MainControl() { try { InitializeComponent(); //set theme loginUserControl.LicAppId = "SecDevID_WEB_1.0.0.0_1521808771"; // provide lic appid loginUserControl.LicSecretekey = "vtechdev"; // provide secreate Key appid loginUserControl.AppVersionId = "Dev_AND_1523"; // provide app version loginUserControl.AppLicNo = "127"; // provide app version //loginUserControl.LicAppPath = GV.loginappPath; timer.loginControlInstance = loginUserControl; loginUserControl.ReadConfigurations(); bool isUserLogin = utility.IsUserLogin(); loginUserControl.LoginButtonClick += LoginUserControl_LoginButtonClick; loginUserControl.CloseButtonClick += LoginUserControl_CloseButtonClick; if (isUserLogin == false) { //do processsing here for show/hide control loginUserControl.Visibility = System.Windows.Visibility.Visible; groupBox.Visibility = System.Windows.Visibility.Collapsed; groupBox1.Visibility = System.Windows.Visibility.Collapsed; groupBox2.Visibility = System.Windows.Visibility.Collapsed; groupBox4.Visibility = System.Windows.Visibility.Collapsed; btn_openXMLMan.Visibility = System.Windows.Visibility.Collapsed; BtnLogOut.Visibility = System.Windows.Visibility.Collapsed; } else { VirtuaLicense.Entities.LicenseStatus status = utility.CheckValidLicense(); if (status.licStatus == false) { System.Windows.MessageBox.Show(status.licMessage); loginUserControl.Visibility = System.Windows.Visibility.Visible; //Show Login Screen or any Other Redirections groupBox.Visibility = System.Windows.Visibility.Collapsed; groupBox1.Visibility = System.Windows.Visibility.Collapsed; groupBox2.Visibility = System.Windows.Visibility.Collapsed; groupBox4.Visibility = System.Windows.Visibility.Collapsed; btn_openXMLMan.Visibility = System.Windows.Visibility.Collapsed; BtnLogOut.Visibility = System.Windows.Visibility.Collapsed; } else { loginUserControl.Visibility = System.Windows.Visibility.Collapsed; timer.InitalizeTimer(); groupBox.Visibility = System.Windows.Visibility.Visible; groupBox1.Visibility = System.Windows.Visibility.Visible; groupBox2.Visibility = System.Windows.Visibility.Visible; groupBox4.Visibility = System.Windows.Visibility.Visible; btn_openXMLMan.Visibility = System.Windows.Visibility.Visible; BtnLogOut.Visibility = System.Windows.Visibility.Visible; } } this.Loaded += UserControl1_Loaded; fetchDATA(); //load ribbon GV.Doc.SendStringToExecute("AAui ", true, false, true); } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void btn_selectLabels_Click(object sender, RoutedEventArgs e) { try { //check if defnition and note list are selected if (checkifDefnitionsSelected()) { //rest progressbar proBar.Value = 0; GV.all_label_coll.Clear(); clearUIValues(); GV.clearSelection(); tBox_Heading.Text = ""; LCH.getCurrentDwgVars(); using (GV.Doc.LockDocument()) { GH.writeLog("\n Running command : btn_selectLabels_Click"); PromptSelectionResult psRes = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetSelection(new SelectionFilter(LCH.selectionFilter(GV.labelFilterType))); if (psRes.Status == PromptStatus.OK) { SelectionSet acSSet = psRes.Value; GV.selObjects_forProcessing = acSSet.GetObjectIds(); GH.qprint("Number of objects selected: " + psRes.Value.Count); GH.writeLog("\nNumber of objects selected: " + psRes.Value.Count); //get key notes based on the selection #region process labels Styles bw.WorkerSupportsCancellation = true; bw.WorkerReportsProgress = true; //bw.ProgressChanged += bw_ProgressChanged; bw.DoWork += new DoWorkEventHandler(bw_UpdateProgressBar); //start work if (bw.IsBusy != true) { bw.RunWorkerAsync(); } int index = 1; int objCount = GV.selObjects_forProcessing.Count(); GV.pBarMaxVal = objCount; //GV.pmeter.Start("Processing Labels"); //GV.pmeter.SetLimit(objCount); foreach (ObjectId objID in GV.selObjects_forProcessing) { LCH.getlabelvalueSpecific(objID); #region ProgressBAR GH.printDebug("", "", false, true); GV.pBarStatus = "Labels Processed: " + index + @"/" + objCount; UpdateProgressBar(index, objCount, GV.pBarStatus); //GV.pmeter.MeterProgress(); Helper.UIHelper.DoEvents(); GV.pBarCurrentVal = index; //assign it work //bw.ReportProgress(index); index++; #endregion } //GV.pmeter.Stop(); //LCH.getlabelvalues(); //LCH.getlabelvalues(acSSet.GetObjectIds(), trans); updateUIdata(); UIH.toastIT("All selected labels processed successfully!", "Status", NotificationType.Success); #endregion } } } else { UIH.toastIT("Check if defintion and note files are selected!", "Missing defintion/note file", NotificationType.Error); } } catch (Autodesk.Civil.CivilException ex) { GH.errorBox(ex.ToString()); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { GH.errorBox(ex.ToString()); } catch (System.Exception ee) { GH.errorBox(ee.ToString()); } }
private void btn_selectLabel_SST_Click(object sender, RoutedEventArgs e) { try { LCH.getCurrentDwgVars(); //rest progressbar proBar.Value = 0; GV.all_label_coll.Clear(); clearUIValues(); GV.clearSelection(); tBox_Heading.Text = ""; //read the label get the label name and KN values based on the KN location from SST file using (GV.Doc.LockDocument()) { GH.writeLog("\n Running command : btn_selectLabels_Click"); PromptSelectionResult psRes = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetSelection(new SelectionFilter(LCH.selectionFilter(GV.labelFilterType))); if (psRes.Status == PromptStatus.OK) { SelectionSet acSSet = psRes.Value; GV.selObjects_forProcessing = acSSet.GetObjectIds(); GH.qprint("Number of objects selected: " + psRes.Value.Count); GH.writeLog("\nNumber of objects selected: " + psRes.Value.Count); } bw.WorkerSupportsCancellation = true; bw.WorkerReportsProgress = true; //bw.ProgressChanged += bw_ProgressChanged; bw.DoWork += new DoWorkEventHandler(bw_UpdateProgressBar); //start work if (bw.IsBusy != true) { bw.RunWorkerAsync(); } //check the label name against the SST file and type of label int index = 1; int objCount = GV.selObjects_forProcessing.Count(); GV.pBarMaxVal = objCount; //GV.pmeter.Start("Processing Labels"); //GV.pmeter.SetLimit(objCount); foreach (ObjectId objID in GV.selObjects_forProcessing) { LCH.getlabelvalueSpecific(objID); //go to note list and get the note for the respective KN number that } } } catch (Autodesk.Civil.CivilException ex) { GH.errorBox(ex.ToString()); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { GH.errorBox(ex.ToString()); } catch (System.Exception ee) { GH.errorBox(ee.ToString()); } }
public void updateUIdata() { try { GH.qprint("GV.ObtTypes.Count() ==> 2> " + GV.ObtTypes.Count()); foreach (var item in GV.noteTypesCurrent) { GH.qprint("GV.noteTypesCurrent > > " + item.Key + " | " + item.Value); } GV.noteTypesCurrent.Clear(); //update selection list GH.qprint("GV.Mapper.Count(): " + GV.Mapper.Count()); GV.ObtTypes.Clear(); GH.qprint("GV.ObtTypes.Count() ==> 2> " + GV.ObtTypes.Count()); foreach (var noteitem in GV.allnotes) { //test if (GV.Mapper.ContainsKey(noteitem.Key)) { GH.qprint("noteitem.Key in Mapper > > " + noteitem.Key); if (!GV.noteTypesCurrent.ContainsKey(noteitem.Key)) { GH.qprint("noteitem.Key adding to current > > " + noteitem.Key); GV.noteTypesCurrent.Add(noteitem.Key, noteitem.Value); } if (!GV.ObtTypes.Contains(GV.Mapper[noteitem.Key])) { string ObjTypeName = GV.Mapper[noteitem.Key]; if (GV.SelectedObjTypes.Contains(ObjTypeName)) { GH.qprint("GV.ObtTypes > > " + GV.Mapper[noteitem.Key]); GV.ObtTypes.Add(ObjTypeName); } } } else { GH.qprint("noteitem.Key not in Mapper > > " + noteitem.Key); foreach (var item in GV.Mapper) { GH.qprint("GV.Mapper > > " + item.Key + " | " + item.Key); } } } cBox_objectType.ItemsSource = GV.ObtTypes; //cBox_objectType.SelectedIndex = 0; GH.qprint("GV.ObtTypes.Count() ==> 3> " + GV.ObtTypes.Count()); lBox_CurrentNotes.ItemsSource = GV.noteTypesCurrent.Values; foreach (string ObtTypes in GV.ObtTypes) { List <Global.labelItem> filteredLabels = GV.all_label_coll.Where(o => o.objType == ObtTypes).ToList <Global.labelItem>(); if (!GV.all_label_coll_Sorted.ContainsKey(ObtTypes)) { GV.all_label_coll_Sorted.Add(ObtTypes, filteredLabels); } else { GV.all_label_coll_Sorted[ObtTypes] = filteredLabels; } } //if more than one objectype present in the cbox then display that if (cBox_objectType.Items.Count > 0) { cBox_objectType.SelectedIndex = 0; } } catch (System.Exception ee) { GH.writeLog(ee.ToString()); } }
private void btn_learn_Click(object sender, RoutedEventArgs e) { try { collIndex = 0; selObjs.Clear(); LCH.getCurrentDwgVars(); using (GV.Doc.LockDocument()) { //ask the user to pick a style to read about the style //Seleciton options, with single selection PromptSelectionOptions Options = new PromptSelectionOptions(); Options.SingleOnly = true; //Options.SinglePickInSpace = true; Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView(); PromptSelectionResult psRes = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetSelection(Options, new SelectionFilter(LCH.selectionFilter(GV.labelFilterType))); if (psRes.Status == PromptStatus.OK) { SelectionSet acSSet = psRes.Value; GV.selObjects_forProcessing = acSSet.GetObjectIds(); foreach (ObjectId objID in GV.selObjects_forProcessing) { //get the name of the label LI = new Global.labelComponentItem(); LI.styleName = LCH.getLabelName(objID); LI.objType = LCH.getObjType(objID); LI.objID = objID; GV.ed.WriteMessage("LI.name: " + LI.styleName); GV.ed.WriteMessage("LI.objType: " + LI.objType); //get the component id which has the value 99 Dictionary<string, string> CompNameVals = new Dictionary<string, string>(); CompNameVals = Helper.LabelTextExtractor.getLabelValsAll(objID); //get the location of the value and store it against the style name and id. int i = 0; LI.KNComponentID = new List<int>(); string KNLoc = ""; foreach (var item in CompNameVals) { if (item.Value == "99") { LI.KNComponentID.Add(Convert.ToInt32(item.Key)); KNLoc = item.Key + ","; i++; } } //check if there is a comman at the end of the KN and remove that KNLoc = KNLoc.Remove(KNLoc.Length - 1); if (selObjs.Where(item => item.styleName == LI.styleName).Any() == false) { selObjs.Add(LI); } //show this on the confirmation box - once the user confirms its then add to the list. or discard that item tBox_styleName.Text = LI.styleName; //tBox_styleKNloc.Text = KNLoc; // ask the user to pick the mapper configuration //store the configuration to settings file } grid_addStyle.Visibility = System.Windows.Visibility.Visible; } } } catch (System.Exception ex) { GH.writeLog(ex.ToString()); } }