private void ChkRibbon_OnUnchecked(object sender, RoutedEventArgs e) { UserConfigFile.SetValue("mpPlinesedit", "LoadRibbonPanel", false.ToString(), true); // unload ribbon PlinesEditRibbonBuilder.RemovePanelFromRibbon(false); }
private void OnClosed(object sender, EventArgs e) { UserConfigFile.SetValue( LevelMark.GetDescriptor().Name, ChkAlignArrowPoints.Name, ChkAlignArrowPoints.IsChecked.ToString(), true); UserConfigFile.SetValue( LevelMark.GetDescriptor().Name, ChkAlignBasePoints.Name, ChkAlignBasePoints.IsChecked.ToString(), true); }
private void ChkRibbon_OnChecked(object sender, RoutedEventArgs e) { UserConfigFile.SetValue("mpPlinesedit", "LoadRibbonPanel", true.ToString(), true); // load ribbon PlinesEditRibbonBuilder.AddPanelToRibbon(false, LvFunctions.ItemsSource as List <PlinesFunction>); }
private void BtOk_OnClick(object sender, RoutedEventArgs e) { UserConfigFile.SetValue("PlObjectToVx", "ExcludeFirstAndLast", ChkExcludeFirstAndLastPt.IsChecked.ToString(), false); UserConfigFile.SetValue("PlObjectToVx", "CopyBlockBy", CbCopyBlockBy.SelectedIndex.ToString(), false); UserConfigFile.SetValue("PlObjectToVx", "RotateBy", CbRotateBy.SelectedIndex.ToString(), false); UserConfigFile.SaveConfigFile(); DialogResult = true; }
private void CopingDistanceSettings_OnClosed(object sender, EventArgs e) { if (CopingDistanceValue.Value != null) { UserConfigFile.SetValue("mprTools", "CopingDistanceValue", CopingDistanceValue.Value.Value.ToString(CultureInfo.InvariantCulture), true); CopingDistanceCommand.DistanceInMm = CopingDistanceValue.Value.Value; } }
private void CbCleanBD_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { var cb = (ComboBox)sender; if (cb != null && cb.SelectedIndex != -1) { UserConfigFile.SetValue(_plName, "cleanBD", cb.SelectedIndex.ToString(), true); } }
#pragma warning restore SA1515 // Single-line comment should be preceded by blank line private void SaveStripFormatItems(IEnumerable <StripFormatItem> stripFormatItems) { foreach (var stripFormatItem in stripFormatItems) { UserConfigFile.SetValue(LangItem, stripFormatItem.Code, stripFormatItem.Selected.ToString(), false); } UserConfigFile.SaveConfigFile(); }
private void CbExteriorConfigurations_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0) { return; } UserConfigFile.SetValue( LangItem, "DefaultExteriorConfiguration", ((ExteriorConfiguration)e.AddedItems[0]).Id.ToString(), true); }
public void HideIcon() { if (ProductsDrawableOverrule.ProductsDrawableOverruleInstance != null) { UserConfigFile.SetValue("mpProductInsert", "ShowIcon", false.ToString(), true); Overrule.RemoveOverrule(RXObject.GetClass(typeof(Entity)), ProductsDrawableOverrule.Instance()); ProductsDrawableOverrule.ProductsDrawableOverruleInstance = null; Application.DocumentManager.MdiActiveDocument.Editor.Regen(); } }
private void SettingsWindow_OnClosed(object sender, EventArgs e) { // save settings UserConfigFile.SetValue( LangItem, "ExteriorFaceMinWidthBetween", TbExteriorFaceMinWidthBetween.Text, false); UserConfigFile.SetValue( LangItem, "MinWallWidth", TbMinWallWidth.Text, false); UserConfigFile.SetValue( LangItem, "ExteriorMinWidthFaceRemove", CbExteriorMinWidthFaceRemove.SelectedIndex.ToString(), false); UserConfigFile.SaveConfigFile(); }
public static void ShowIcon() { if (MpProductsDrawableOverrule.MpProductsDrawableOverruleInstance == null) { UserConfigFile.SetValue(UserConfigFile.ConfigFileZone.Settings, "mpProductInsert", "ShowIcon", true.ToString(), true); Overrule.AddOverrule(RXObject.GetClass(typeof(Entity)), MpProductsDrawableOverrule.Instance(), true); Overrule.Overruling = true; AcApp.DocumentManager.MdiActiveDocument.Editor.Regen(); } }
private static string CurrentStyleGuid(string functionName) { var savedStyleGuid = UserConfigFile.GetValue(functionName, "CurrentStyleGuid"); if (!string.IsNullOrEmpty(savedStyleGuid)) { return(savedStyleGuid); } const string firstSystemGuid = "00000000-0000-0000-0000-000000000000"; UserConfigFile.SetValue(functionName, "CurrentStyleGuid", firstSystemGuid, true); return(firstSystemGuid); }
// Границы ВЭ в модель private void ChkVPtoMS_OnChecked(object sender, RoutedEventArgs e) { if (sender is CheckBox chk) { UserConfigFile.SetValue(UserConfigFile.ConfigFileZone.Settings, "VPtoMS", (chk.IsChecked != null && chk.IsChecked.Value).ToString(), true); if (chk.IsChecked != null && chk.IsChecked.Value) { MiniFunctions.MiniFunctionsContextMenuExtensions.VPtoMSObjectContextMenu.Attach(); } else { MiniFunctions.MiniFunctionsContextMenuExtensions.VPtoMSObjectContextMenu.Detach(); } } }
private void ChkNestedEntLayer_OnChecked(object sender, RoutedEventArgs e) { if (sender is CheckBox chk) { UserConfigFile.SetValue("NestedEntLayerOCM", (chk.IsChecked != null && chk.IsChecked.Value).ToString(), true); if (chk.IsChecked != null && chk.IsChecked.Value) { MiniFunctions.MiniFunctionsContextMenuExtensions.NestedEntLayerObjectContextMenu.Attach(); } else { MiniFunctions.MiniFunctionsContextMenuExtensions.NestedEntLayerObjectContextMenu.Detach(); } } }
// select color private void BtColor_OnClick(object sender, RoutedEventArgs e) { var clr = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, (short)PlinesEditFunction.HelpGeometryColor); var cd = new ColorDialog { Color = clr, IncludeByBlockByLayer = false }; if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { PlinesEditFunction.HelpGeometryColor = cd.Color.ColorIndex; BtColor.Background = new SolidColorBrush(ColorIndexToMediaColor(cd.Color.ColorIndex)); UserConfigFile.SetValue("mpPlinesedit", "HelpGeometryColor", cd.Color.ColorIndex.ToString(CultureInfo.InvariantCulture), true); } }
// Window closing private void MpDbviewerWindow_OnClosed(object sender, EventArgs e) { var cb = CbDataBases; // Сохраняем в файл настроек выбранную базу if (cb?.SelectedIndex != -1) { UserConfigFile.SetValue("mpDBviewer", "selectedDB", cb?.SelectedIndex.ToString(), true); } // Сохраняем выбранную группу var lb = LbGroups; if (lb?.SelectedIndex != -1) { UserConfigFile.SetValue("mpDBviewer", "selectedGroup", cb?.SelectedIndex.ToString(), true); } }
// Окно закрылось private void MpDocTemplate_OnClosed(object sender, EventArgs e) { try { // ReSharper disable once InvertIf if (_textBoxes != null) { foreach (var tb in _textBoxes) { UserConfigFile.SetValue(LangItem, tb.Name, tb.Text, false); } UserConfigFile.SaveConfigFile(); } } catch (System.Exception exception) { ExceptionBox.Show(exception); } }
private void Chk_OnChecked_OnUnchecked(object sender, System.Windows.RoutedEventArgs e) { var checkBox = (CheckBox)sender; if (checkBox != null) { var checkedValue = checkBox.IsChecked != null && checkBox.IsChecked.Value; switch (checkBox.Name) { case "ChkLayer": UserConfigFile.SetValue(_plName, "layer", checkedValue.ToString(), true); break; case "ChkScales": UserConfigFile.SetValue(_plName, "scales", checkedValue.ToString(), true); break; case "ChkTransform": UserConfigFile.SetValue(_plName, "transform", checkedValue.ToString(), true); if (checkedValue) { ChkRotation.IsEnabled = false; ChkRotation.IsChecked = false; } else { ChkRotation.IsEnabled = true; } break; case "ChkRotation": UserConfigFile.SetValue(_plName, "rotation", checkBox.IsEnabled ? checkedValue.ToString() : "False", true); break; } } }
public void MpPrToTableFunction() { #if !DEBUG Statistic.SendCommandStarting(new ModPlusConnector()); #endif try { bool.TryParse(UserConfigFile.GetValue(LangItem, "AskRow"), out _askRow); // Т.к. при нулевом значении строки возвращает ноль, то делаем через if if (int.TryParse(UserConfigFile.GetValue(LangItem, "Round"), out var integer)) { _round = integer; } var doc = AcApp.DocumentManager.MdiActiveDocument; var ed = doc.Editor; var db = doc.Database; var opts = new PromptSelectionOptions(); opts.Keywords.Add(Language.GetItem(LangItem, "h2")); opts.Keywords.Add(Language.GetItem(LangItem, "h3")); var kws = opts.Keywords.GetDisplayString(true); opts.MessageForAdding = $"\n{Language.GetItem(LangItem, "h1")}: {kws}"; opts.KeywordInput += (sender, e) => { if (e.Input.Equals(Language.GetItem(LangItem, "h2"))) { var pko = new PromptKeywordOptions( $"\n{Language.GetItem(LangItem, "h4")} [{Language.GetItem(LangItem, "yes")}/{Language.GetItem(LangItem, "no")}]: ", $"{Language.GetItem(LangItem, "yes")} {Language.GetItem(LangItem, "no")}"); pko.Keywords.Default = _askRow ? Language.GetItem(LangItem, "yes") : Language.GetItem(LangItem, "no"); var promptResult = ed.GetKeywords(pko); if (promptResult.Status != PromptStatus.OK) { return; } _askRow = promptResult.StringResult.Equals(Language.GetItem(LangItem, "yes")); UserConfigFile.SetValue(LangItem, "AskRow", _askRow.ToString(), true); } else if (e.Input.Equals(Language.GetItem(LangItem, "h3"))) { var pio = new PromptIntegerOptions($"\n{Language.GetItem(LangItem, "h5")}: ") { AllowNegative = false, AllowNone = false, AllowZero = true, DefaultValue = _round }; var pir = ed.GetInteger(pio); if (pir.Status != PromptStatus.OK) { return; } _round = pir.Value; UserConfigFile.SetValue("mpPrToTable", "Round", _round.ToString(), true); } }; var res = ed.GetSelection(opts); if (res.Status != PromptStatus.OK) { return; } using (var tr = db.TransactionManager.StartTransaction()) { var selSet = res.Value; var objectIds = selSet.GetObjectIds(); if (objectIds.Length == 0) { return; } var findProductsWin = new FindProductsProgress(objectIds, tr); if (findProductsWin.ShowDialog() == true) { var peo = new PromptEntityOptions($"\n{Language.GetItem(LangItem, "h6")}: "); peo.SetRejectMessage($"\n{Language.GetItem(LangItem, "h7")}"); peo.AddAllowedClass(typeof(Table), false); var per = ed.GetEntity(peo); if (per.Status != PromptStatus.OK) { return; } // fill FillTable(findProductsWin.SpecificationItems, _askRow, _round); } tr.Commit(); } } catch (System.Exception exception) { ExceptionBox.Show(exception); } }
private void SearchEntitiesSettings_OnClosed(object sender, EventArgs e) { UserConfigFile.SetValue(Invariables.LangItem, "SearchProceedOption", CbSearchProceedOption.SelectedIndex.ToString(), true); }
private void ChkUpdaterState_OnUnchecked(object sender, RoutedEventArgs e) { UserConfigFile.SetValue("mprTools", "CopingDistanceUpdaterStatus", false.ToString(), true); CopingDistanceCommand.UpdaterOff(_uiApplication.ActiveAddInId, ref ToolsApp.CopingDistanceUpdater); }
/// <summary> /// Сохранить стиль как Текущий в настройки пользователя /// </summary> /// <param name="style">Сохраняемый стиль</param> public static void SaveCurrentStyleToSettings(IntellectualEntityStyle style) { UserConfigFile.SetValue($"mp{style.EntityType.Name}", "CurrentStyleGuid", style.Guid, true); }
private void MpMainSettings_OnClosed(object sender, EventArgs e) { try { var isDifferentLanguage = IsDifferentLanguage(); // Если отключили плавающее меню if (!ChkMpFloatMenu.IsChecked.Value) { // Закрываем плавающее меню if (MpMenuFunction.MpMainMenuWin != null) { MpMenuFunction.MpMainMenuWin.Close(); } } else // Если включили плавающее меню { // Если плавающее меню было включено if (MpMenuFunction.MpMainMenuWin != null) { // Перегружаем плавающее меню, если изменилась тема, вкл/выкл открытые чертежи, сворачивать в if (!Regestry.GetValue("PluginStyle").Equals(_curTheme) || !Regestry.GetValue("FloatMenuCollapseTo").Equals(_curFloatMenuCollapseTo.ToString()) || !ChkMpChkDrwsOnMnu.IsChecked.Value.Equals(_curDrawingsOnMenu) || isDifferentLanguage) { MpMenuFunction.MpMainMenuWin.Close(); MpMenuFunction.LoadMainMenu(); } } else { MpMenuFunction.LoadMainMenu(); } } // если отключили палитру if (!ChkMpPalette.IsChecked.Value) { if (MpPalette.MpPaletteSet != null) { MpPalette.MpPaletteSet.Visible = false; } } else // если включили палитру { MpPalette.CreatePalette(); } // Если отключили плавающее меню Чертежи if (!ChkMpDrawingsAlone.IsChecked.Value) { if (MpDrawingsFunction.MpDrawingsWin != null) { MpDrawingsFunction.MpDrawingsWin.Close(); } } else { if (MpDrawingsFunction.MpDrawingsWin != null) { // Перегружаем плавающее меню, если изменилась тема, вкл/выкл открытые чертежи, границы, сворачивать в if (!Regestry.GetValue("PluginStyle").Equals(_curTheme) || !Regestry.GetValue("DrawingsCollapseTo").Equals(_curDrawingsCollapseTo.ToString()) || !ChkMpDrawingsAlone.IsChecked.Value.Equals(_curDrawingsAlone) || isDifferentLanguage) { MpDrawingsFunction.MpDrawingsWin.Close(); MpDrawingsFunction.LoadMainMenu(); } } else { MpDrawingsFunction.LoadMainMenu(); } } // Ribbon // Если включили и была выключена if (ChkMpRibbon.IsChecked.Value && !_curRibbon) { RibbonBuilder.BuildRibbon(); } // Если включили и была включена, но сменился язык if (ChkMpRibbon.IsChecked.Value && _curRibbon && isDifferentLanguage) { RibbonBuilder.RemoveRibbon(); RibbonBuilder.BuildRibbon(true); } // Если выключили и была включена if (!ChkMpRibbon.IsChecked.Value && _curRibbon) { RibbonBuilder.RemoveRibbon(); } // context menu // если сменился язык, то все выгружаю if (isDifferentLanguage) { MiniFunctions.UnloadAll(); } MiniFunctions.LoadUnloadContextMenu(); // License server UserConfigFile.SetValue(UserConfigFile.ConfigFileZone.Settings, "DisableConnectionWithLicenseServerInAutoCAD", ChkDisableConnectionWithLicenseServer.IsChecked.Value.ToString(), true); Regestry.SetValue("LocalLicenseServerIpAddress", TbLocalLicenseServerIpAddress.Text); Regestry.SetValue("LocalLicenseServerPort", TbLocalLicenseServerPort.Value.ToString()); if (_restartClientOnClose) { // reload server ClientStarter.StopConnection(); ClientStarter.StartConnection(ProductLicenseType.AutoCAD); } // перевод фокуса на автокад Utils.SetFocusToDwgView(); } catch (Exception ex) { ExceptionBox.Show(ex); } }
private void ChkWipeoutEditOCM_OnUnchecked(object sender, RoutedEventArgs e) { UserConfigFile.SetValue(UserConfigFile.ConfigFileZone.Settings, "WipeoutEditOCM", false.ToString(), true); MiniFunctions.MiniFunctionsContextMenuExtensions.WipeoutEditObjectContextMenu.Detach(); }
private void ChkShowModel_OnChecked_OnUnchecked(object sender, RoutedEventArgs e) { var flag = ChkShowModel.IsChecked ?? false; UserConfigFile.SetValue("mpLayoutManager", "ShowModel", flag.ToString(), true); }
/// <summary> /// Сохраняет путь к папке пользовательской базы /// </summary> /// <param name="folder">Путь к папке пользовательской базы</param> public static void SetCustomBaseFolder(string folder) { _customBaseFolder = folder; UserConfigFile.SetValue(LangItem, "CustomBaseFolder", folder, true); }
public static void StartFunction() { #if !DEBUG Statistic.SendCommandStarting(ModPlusConnector.Instance); #endif var doc = AcApp.DocumentManager.MdiActiveDocument; var db = doc.Database; var ed = doc.Editor; var points = new Point2dCollection(); var polyline = new Polyline(); try { // Блокируем документ using (doc.LockDocument()) { // Стартуем транзакцию (т.к. создаем объект) using (var tr = doc.TransactionManager.StartTransaction()) { // Выбор первого примитива (кривой) var peo = new PromptEntityOptions($"\n{Language.GetItem(PlinesEditFunction.LangItem, "k27")}:") { AllowNone = false, AllowObjectOnLockedLayer = true }; peo.SetRejectMessage($"\n{Language.GetItem(PlinesEditFunction.LangItem, "wrong")}"); peo.AddAllowedClass(typeof(Polyline2d), true); peo.AddAllowedClass(typeof(Polyline3d), true); peo.AddAllowedClass(typeof(Polyline), true); peo.AddAllowedClass(typeof(Line), true); peo.AddAllowedClass(typeof(Spline), true); peo.AddAllowedClass(typeof(Polyline2d), true); var per = ed.GetEntity(peo); if (per.Status != PromptStatus.OK) { return; } var firstCurve = tr.GetObject(per.ObjectId, OpenMode.ForRead) as Curve; if (firstCurve == null) { return; } // Выбор второго примитива (кривой) peo.Message = $"\n{Language.GetItem(PlinesEditFunction.LangItem, "k28")}:"; per = ed.GetEntity(peo); if (per.Status != PromptStatus.OK) { return; } var secondCurve = tr.GetObject(per.ObjectId, OpenMode.ForRead) as Curve; if (secondCurve == null) { return; } // Количество опорных точек var pio = new PromptIntegerOptions($"\n{Language.GetItem(PlinesEditFunction.LangItem, "k29")}:") { DefaultValue = int.TryParse(UserConfigFile.GetValue("mpPl_MiddleLine", "PointCount"), out var i) ? i : 100, LowerLimit = 2, UpperLimit = 1000 }; var pir = ed.GetInteger(pio); if (pir.Status != PromptStatus.OK) { return; } var oporPtCount = pir.Value; UserConfigFile.SetValue("mpPl_MiddleLine", "PointCount", oporPtCount.ToString(CultureInfo.InvariantCulture), true); // Получаем коллекцию точек для построения новой полилинии for (var j = 0; j < oporPtCount; j++) { var firstDist = (firstCurve.GetDistanceAtParameter(firstCurve.EndParam) - firstCurve.GetDistanceAtParameter(firstCurve.StartParam)) / oporPtCount; var secondDist = (secondCurve.GetDistanceAtParameter(secondCurve.EndParam) - secondCurve.GetDistanceAtParameter(secondCurve.StartParam)) / oporPtCount; var firstPoint = firstCurve.GetPointAtParameter(firstCurve.GetParameterAtDistance(firstDist * j)); // var secondPoint = // secondCurve.GetPointAtParameter(secondCurve.GetParameterAtDistance(secondDist * j)); var secondPoint = secondCurve.GetClosestPointTo(firstPoint, false); points.Add(new Point2d( (firstPoint.X + secondPoint.X) / 2, (firstPoint.Y + secondPoint.Y) / 2)); } // Строим полилинию if (points.Count > 0) { var btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite, false); for (var k = 0; k < points.Count; k++) { polyline.AddVertexAt(k, points[k], 0.0, 0.0, 0.0); } btr.AppendEntity(polyline); tr.AddNewlyCreatedDBObject(polyline, true); } tr.Commit(); } // Запрос на упрощение полилинии if (points.Count > 2) { if (MessageBox.ShowYesNo(Language.GetItem(PlinesEditFunction.LangItem, "k30"), MessageBoxIcon.Question)) { RemovePointsFromPolyline(polyline.ObjectId); } } } } catch (System.Exception exception) { ExceptionBox.Show(exception); } }
private void ChkAddToMpPalette_OnChecked_OnUnchecked(object sender, RoutedEventArgs e) { var flag = ChkAddToMpPalette.IsChecked ?? false; UserConfigFile.SetValue("mpLayoutManager", "AddToMpPalette", flag.ToString(), true); }