private void Button_Click(object sender, RoutedEventArgs args) { try { var sw = new ModelSw(); sw.Lono(); } catch (Exception e) { MessageBox.Show(e.Message); } }
void BuildRoof_Click(object sender, RoutedEventArgs e) { try { var sw = new ModelSw(); sw.Roof(TypeOfRoof.Text, WidthRoof.Text, LenghtRoof.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BuildDamper_Click(object sender, RoutedEventArgs e) { try { var sw = new ModelSw(); sw.Dumper(TypeOfDumper.Text, WidthDamper.Text, HeightDamper.Text, false, null); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void BuildRoof_Click(object sender, RoutedEventArgs e) { try { var sw = new ModelSw(); sw.Roof(TypeOfRoof.Text, WidthRoof.Text, LenghtRoof.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static AirVentsCadWpf.AirVentsClasses.UnitsBuilding.ModelSw Instance() { if (Executor == null) { System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("AirVentsCad.exe"); foreach (var process in processes) { process.Kill(); } Executor = new AirVentsCadWpf.AirVentsClasses.UnitsBuilding.ModelSw(); } return(Executor); }
void UserControl_Loaded_1(object sender, RoutedEventArgs e) { _bw.DoWork += ((o, args) => { Dispatcher.Invoke(DispatcherPriority.Background, EmptyDelegate); // Dispatcher.Thread.SetApartmentState(new ApartmentState()); Dispatcher.InvokeAsync( ()=> { try { var sw = new ModelSw(); if (Unit50Full.IsChecked == true) { if (FrameOffset.Text == "") { try { FrameOffset.Text = Convert.ToString(Convert.ToDouble(Lenght.Text) / 2); } catch (Exception) { FrameOffset.Text = Convert.ToString(Convert.ToDouble(Lenght.Text) / 2); } } //Dispatcher.Invoke( // () => // sw.UnitAsmbly(SizeOfUnit.Text, "00", "",WidthU.Text, HeightU.Text, // Lenght.Text, Thikness.Text, TypeOfFrame.Text, // FrameOffset.Text, new[] { null, TypeOfPanel50.Text }, MaterialP1.Text, MaterialP2.Text, "", "")); //// Parallel.Invoke(() => sw.UnitAsmbly(SizeOfUnit.Text, "00", WidthU.Text, HeightU.Text, Lenght.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text)); //sw.UnitAsmbly(SizeOfUnit.Text, "00", WidthU.Text, HeightU.Text, // Lenght.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text); } else if (MontageFrame50.IsChecked == true) { if (FrameOffset.Visibility == Visibility.Collapsed & LenghtBaseFrame.Text != "") { try { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text)/2)); } catch (Exception) { FrameOffset.Text = Convert.ToString(150); } } sw.MontageFrame(WidthBaseFrame.Text, LenghtBaseFrame.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text, MaterialMontageFrame.Text, null); } else if (TypeOfUnit50.IsChecked == true) { } else if (Panel50.IsChecked == true) { sw.Panels50Build( new[] { null, TypeOfPanel50.Text }, WidthPanel.Text, HeightPanel.Text, new[] { "Az", null }, new[] { "Az", null }, null); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }); }); //Dispatcher.Thread.SetApartmentState(new ApartmentState()); Dispatcher.InvokeAsync(() => { //var sw = new ModelSw(); //sw.CreateDistDirectory(string.Format(@"{0}\{1}", @Properties.Settings.Default.DestinationFolder, // sw.Unit50Folder)); //sw.CreateDistDirectory(string.Format(@"{0}\{1}", @Properties.Settings.Default.DestinationFolder, // sw.Panel50DestinationFolder)); //sw.CreateDistDirectory(string.Format(@"{0}\{1}", @Properties.Settings.Default.DestinationFolder, // sw.BaseFrameDestinationFolder)); }); }
void BUILDING_Click(object sender, RoutedEventArgs args) { var sw = new ModelSw(); switch (thicknessOfPanel) { case "30": var frame = ""; try { if (MontageFrame50.IsChecked == true) { if (FrameOffset.Text == "") { try { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } catch (Exception) { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } } frame = sw.MontageFrameS( WidthBaseFrame.Text, LenghtBaseFrame.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text, MaterialMontageFrame.SelectedValue.ToString(), new[] { RalFrame1.Text, CoatingTypeFrame1.Text, CoatingClassFrame1.Text, RalFrame1.SelectedValue?.ToString() ?? "" }, true); FrameOffset.Text = ""; } var mat1Code = ""; var mat2Code = ""; var viewRowMat1 = (DataRowView)MaterialP1.SelectedItem; var row1 = viewRowMat1.Row; if (row1 != null) mat1Code = row1.Field<string>("CodeMaterial"); var viewRowMat2 = (DataRowView)MaterialP2.SelectedItem; var row2 = viewRowMat2.Row; if (row2 != null) mat2Code = row2.Field<string>("CodeMaterial"); #region Панели var materialP1 = new[] { MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code }; var materialP2 = new[] { MaterialP2.SelectedValue.ToString(), ТолщинаВннутренней.Text, MaterialP2.Text, mat2Code }; string panelWxL = null; string panelHxL = null; string panelHxL04 = null; if (Panel50.IsChecked == true) { try { //Верх - Низ try { sw.Panels30Build( typeOfPanel: new[] { SqlBaseData.PanelsTable().Rows[0][2].ToString(), SqlBaseData.PanelsTable().Rows[0][1].ToString(), "30" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - 60), height: Convert.ToString(Convert.ToInt32(WidthU.Text) - 60), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, path: out panelWxL); } catch (Exception) { // ignored } //Несъемная try { sw.Panels30Build( typeOfPanel: new[] { SqlBaseData.PanelsTable().Rows[0][2].ToString(), SqlBaseData.PanelsTable().Rows[0][1].ToString(), "30" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - 60), height: Convert.ToString(Convert.ToInt32(HeightU.Text) - 60), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, path: out panelHxL); } catch (Exception) { // ignored } //Cъемная try { sw.Panels30Build( typeOfPanel: new[] { TypeOfPanel50.SelectedValue.ToString(), TypeOfPanel50.Text, "30" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - 60), height: Convert.ToString(Convert.ToInt32(HeightU.Text) - 60), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, path: out panelHxL04); } catch (Exception e) { MessageBox.Show(e.ToString()); } } catch (Exception e) { MessageBox.Show(e.ToString()); } } #endregion var panels = new[] { panelWxL, panelHxL, panelHxL04 }; var roofType = TypeOfRoof.Text; if (RoofOfUnit50.IsChecked != true) { roofType = ""; } sw.UnitAsmbly30(((DataRowView)SizeOfUnit.SelectedItem)["Type"].ToString(), OrderTextBox.Text, SideService.Text, WidthU.Text, HeightU.Text, Lenght.Text, frame, panels, roofType, "Section " + SectionTextBox.Text); } catch (Exception e) { MessageBox.Show(e.Message); } break; default: frame = ""; try { if (MontageFrame50.IsChecked == true) { if (FrameOffset.Text == "") { try { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } catch (Exception) { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } } frame = sw.MontageFrameS( WidthBaseFrame.Text, LenghtBaseFrame.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text, MaterialMontageFrame.SelectedValue.ToString(), new[] { RalFrame1.Text, CoatingTypeFrame1.Text, CoatingClassFrame1.Text, RalFrame1.SelectedValue?.ToString() ?? "" }, true); FrameOffset.Text = ""; } var mat1Code = ""; var mat2Code = ""; var viewRowMat1 = (DataRowView)MaterialP1.SelectedItem; var row1 = viewRowMat1.Row; if (row1 != null) mat1Code = row1.Field<string>("CodeMaterial"); var viewRowMat2 = (DataRowView)MaterialP2.SelectedItem; var row2 = viewRowMat2.Row; if (row2 != null) mat2Code = row2.Field<string>("CodeMaterial"); #region Панели var materialP1 = new[] { MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code }; var materialP2 = new[] { MaterialP2.SelectedValue.ToString(), ТолщинаВннутренней.Text, MaterialP2.Text, mat2Code }; string panelWxL = null; string panelHxL = null; string panelHxL04 = null; var panelsDelta = TypeOfPanel.SelectedIndex == 0 ? 100 : 140; if (Panel50.IsChecked == true) { try { //Верх - Низ try { panelWxL = sw.Panels50BuildStr( typeOfPanel: new[] { SqlBaseData.PanelsTable().Rows[0][2].ToString(), SqlBaseData.PanelsTable().Rows[0][1].ToString(), TypeOfPanel.SelectedIndex==0 ? "50":"70" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - panelsDelta), height: Convert.ToString(Convert.ToInt32(WidthU.Text) - panelsDelta), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, onlyPath: true); } catch (Exception) { // } //Несъемная try { panelHxL = sw.Panels50BuildStr( typeOfPanel: new[] { SqlBaseData.PanelsTable().Rows[0][2].ToString(), SqlBaseData.PanelsTable().Rows[0][1].ToString(), TypeOfPanel.SelectedIndex==0 ? "50":"70" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - panelsDelta), height: Convert.ToString(Convert.ToInt32(HeightU.Text) - panelsDelta), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, onlyPath: true); } catch (Exception) { // } //Cъемная try { panelHxL04 = sw.Panels50BuildStr( typeOfPanel: new[] { TypeOfPanel50.SelectedValue.ToString(), TypeOfPanel50.Text, TypeOfPanel.SelectedIndex==0 ? "50":"70" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - panelsDelta), height: Convert.ToString(Convert.ToInt32(HeightU.Text) - panelsDelta), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, onlyPath: true); } catch (Exception e) { MessageBox.Show(e.ToString()); } } catch (Exception e) { MessageBox.Show(e.ToString()); } } #endregion var panels = new[]{panelWxL , panelHxL, panelHxL04}; var roofType = TypeOfRoof.Text; if (RoofOfUnit50.IsChecked != true){roofType = "";} sw.UnitAsmbly(((DataRowView)SizeOfUnit.SelectedItem)["Type"].ToString(), OrderTextBox.Text, SideService.Text, WidthU.Text, HeightU.Text, Lenght.Text, frame, panels, roofType, "Section " + SectionTextBox.Text, thicknessOfPanel == "50" ? "150" : "170"); } catch (Exception e) { MessageBox.Show(e.Message); } break; } }
void BuildDamper_Click(object sender, RoutedEventArgs e) { var mat1Code = ""; var viewRowMat1 = (DataRowView)MaterialP1.SelectedItem; var row1 = viewRowMat1.Row; if (row1 != null) mat1Code = row1.Field<string>("CodeMaterial"); var materialP1 = new[] { MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code }; //goto m2; #region ModelSw try { #region CodeMaterial //var mat1Code = ""; //var viewRowMat1 = (DataRowView)MaterialP1.SelectedItem; //var row1 = viewRowMat1.Row; //if (row1 != null) // mat1Code = row1.Field<string>("CodeMaterial"); //var materialP1 = new[] { MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code }; //var vcad = new VentsCadLibrary.VentsCad //{ // ConnectionToSql = Settings.Default.ConnectionToSQL, // DestVaultName = Settings.Default.TestPdmBaseName, // VaultName = Settings.Default.PdmBaseName //}; //string unit; //vcad.DumperS(TypeOfDumper.Text, WidthDamper.Text, HeightDamper.Text, (IsOutDoor.IsChecked == true), materialP1, out unit, false); //MessageBox.Show("Finish"); //return; #endregion var sw = new ModelSw(); sw.Dumper(TypeOfDumper.Text, WidthDamper.Text, HeightDamper.Text, (IsOutDoor.IsChecked == true), materialP1); } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); } return; #endregion m1: //VentsCadLibrary try { using (var server = new VentsCadLibrary.VentsCad()) { var newDumper = new VentsCadLibrary.VentsCad.Dumper(TypeOfDumper.Text, WidthDamper.Text, HeightDamper.Text, (IsOutDoor.IsChecked == true), materialP1); if (!newDumper.Exist) { newDumper.Build(); } var place = newDumper.GetPlace(); MessageBox.Show(place.Path + "\n" + place.IdPdm + "\n" + place.ProjectId); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return; m2: // VentsCadService MessageBox.Show("VentsCadService"); try { var serv = new ServiceV( new VentsCadService.Parameters { Name = "dumper", Type = new VentsCadService.Type { SubType = TypeOfDumper.Text }, Sizes = new VentsCadService.Sizes[] { new VentsCadService.Sizes { Width = WidthDamper.Text, Height = HeightDamper.Text } }, Materials = new VentsCadService.Material[] { new VentsCadService.Material { Code = materialP1[3], Name = materialP1[2], Thikness = materialP1[1], Value = materialP1[0], } } }); var Build = new Task(serv.build); Build.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void BUILDING_Click(object sender, RoutedEventArgs e) { if (LenghtBaseFrame.Text == "") { return; } if (FrameOffset.Text == "") { try { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } catch (Exception) { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } } //goto m2; //ModelSw var sw = new ModelSw(); sw.MontageFrame( WidthBaseFrame.Text, LenghtBaseFrame.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text, MaterialMontageFrame.SelectedValue.ToString(), new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral1.SelectedValue?.ToString() ?? "" }); FrameOffset.Text = ""; return; m1: // VentsCadLibrary try { using (var server = new VentsCadLibrary.VentsCad()) { var newDumper = new VentsCadLibrary.VentsCad.MontageFrame(TypeOfFrame.Text, WidthBaseFrame.Text, LenghtBaseFrame.Text, FrameOffset.Text, new VentsCadLibrary.VentsCad.ProductFactory.Material { Name = MaterialMontageFrame.Text, Thikness = Thikness.Text, Value = MaterialMontageFrame.SelectedValue.ToString(), }); if (!newDumper.Exist) { newDumper.Build(); } var place = newDumper.GetPlace(); MessageBox.Show(place.Path + "\n" + place.IdPdm + "\n" + place.ProjectId); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return; m2: // VentsCadService MessageBox.Show("VentsCadService"); try { var serv = new ServiceV( new VentsCadService.Parameters { Name = "montageFrame", Type = new VentsCadService.Type { SubType = TypeOfFrame.Text }, Sizes = new VentsCadService.Sizes[] { new VentsCadService.Sizes { Width = TypeOfFrame.Text, Lenght = WidthBaseFrame.Text, Additional1 = FrameOffset.Text } }, Materials = new VentsCadService.Material[] { new VentsCadService.Material { Name = MaterialMontageFrame.Text, Thikness = Thikness.Text, Value = MaterialMontageFrame.SelectedValue.ToString(), } } }); var Build = new Task(serv.build); Build.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } FrameOffset.Text = ""; }
void BUILDING_Click(object sender, RoutedEventArgs args) { PartsPdmTable.ItemsSource = null; if (!Totals.RemPanWidthCheck(ШиринаСъемнойПанели2, 2)) return; if (!Totals.RemPanWidthCheck(ШиринаСъемнойПанели3, 3)) return; if (!Totals.RemPanWidthCheck(ШиринаСъемнойПанели1, 1)) return; Логгер.Информация("Начато построение бескаркасной установки","", "Сохранение настроек программы", "FramelessUnitUc"); try { var modelSw = new ModelSw(); #region PathToBlock if (onlySearch.IsChecked != true) { var framelessBlockNewName = $"{SizeOfUnit.Text} {OrderTextBox.Text}B Section {SectionTextBox.Text}"; var orderFolder = $@"{Settings.Default.DestinationFolder}\{ModelSw.UnitFramelessOreders}\{SizeOfUnit.Text}\{SizeOfUnit.Text} {OrderTextBox.Text}B"; var framelessBlockNewPath = new FileInfo($@"{orderFolder}\{framelessBlockNewName}.SLDASM").FullName; if (ModelSw.OpenIfExist(framelessBlockNewPath, VaultSystem.VentsCadFile.Type.Assembly, null)) return; } #endregion var width = Convert.ToDouble(WidthU.Text); var height = Convert.ToDouble(HeightU.Text); var lenght = Convert.ToDouble(Lenght.Text); #region Панели var materialP1 = new[] {MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text}; var materialP2 = new[] { MaterialP2.SelectedValue.ToString(), ТолщинаВннутренней.Text, Шумоизоляция.SelectedValue.ToString(), ПрименениеСкотча.SelectedValue.ToString() }; string panelUp = null; string panelDown = null; string panelFixed = null; // var config = Левая.IsChecked == true ? "01" : "02"; var configDown = Левая.IsChecked == true ? "02" : "01"; var leftSide = Левая.IsChecked == true; var addingConstructParameters = new AddingConstructParameters(); var typeOfDoubleКриша = (ComboBoxItem) КришаТипСдвоенойПанели.SelectedItem; var typeOfDoubleStrКриша = КришаТипСдвоенойПанели.Visibility == Visibility.Visible ? typeOfDoubleКриша.Name.Replace("n", "") : "00"; var typeOfDoubleОпорнаяЧасть = (ComboBoxItem) ОпорнаяЧастьТипСдвоенойПанели.SelectedItem; var typeOfDoubleStrОпорнаяЧасть = ОпорнаяЧастьТипСдвоенойПанели.Visibility == Visibility.Visible ? typeOfDoubleОпорнаяЧасть.Name.Replace("n", "") : "00"; var typeOfDoubleНесъемнаяПанель = (ComboBoxItem) НесъемнаяПанельСдвоенойПанели.SelectedItem; var typeOfDoubleStrНесъемнаяПанель = НесъемнаяПанельСдвоенойПанели.Visibility == Visibility.Visible ? typeOfDoubleНесъемнаяПанель.Name.Replace("n", "") : "00"; // MessageBox.Show($"Криша - {typeOfDoubleStrКриша}\nОпорнаяЧасть - {typeOfDoubleStrОпорнаяЧасть}\nНесъемнаяПанель - {typeOfDoubleStrНесъемнаяПанель}"); var ironwares = new ModelSw.Ironwares { Height = height, Width = width, Lenght = lenght, TypeOfDownPanel = typeOfDoubleStrОпорнаяЧасть, TypeOfUnremPanel = typeOfDoubleStrНесъемнаяПанель, TypeOfUpPanel = typeOfDoubleStrКриша }; modelSw.PartsToDeleteList = new List<KeyValuePair<string, string>>(); #region Панели Торцевые string panelBack1 = null;string panelBack2 = null; List<string> partsToDeleteList; var existingAsmsAndParts2 = new List<ModelSw.ExistingAsmsAndParts>(); const string noBrush = "Без покрытия"; var покрытие = new[] { Ral1.Text, Ral1.Text != noBrush ? CoatingType1.Text : "0", Ral1.Text != noBrush ? CoatingClass1.Text : "0", Ral2.Text, Ral2.Text != noBrush ? CoatingType2.Text : "0", Ral2.Text != noBrush ? CoatingClass2.Text : "0", Ral1.SelectedValue?.ToString() ?? noBrush, Ral2.SelectedValue?.ToString() ?? noBrush }; var screwsBackPanel = new ModelSw.Screws { ByWidth = ironwares.ScrewsByHeight - 1000, ByHeight = ironwares.ScrewsByWidth - 1000, ByWidthInnerUp = ironwares.ScrewsByHeight, ByHeightInnerUp = ironwares.ScrewsByWidth }; var typeOfBackPanel = new[] { "35", "Торцевая панель", Convert.ToString(SqlBaseData.PanelsTypeId("35")) }; if (НаличиеТорцевойПанели.SelectedIndex == 1 || НаличиеТорцевойПанели.SelectedIndex == 3) { try { if (!(PartsGenerationChk.IsChecked == true & BackPanels.IsChecked != true)) { //const string paneltype = "Панель торцевая первая"; List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelBack1 = modelSw.PanelsFramelessStr( typeOfPanel: typeOfBackPanel, width: Convert.ToString(height - 40), height: Convert.ToString(width - 40), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: _panelBack, isLeftSide: leftSide, расположениеПанелей: "", покрытие: покрытие, расположениеВставок: "", первыйТип: null, типТорцевой: ParmsOfBackPanel1(), типДвойной: "00", screws: screwsBackPanel, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Логгер.Ошибка(ex.Message, ex.StackTrace, ex.TargetSite.ToString(),"FramelessUnitUc"); } } if (НаличиеТорцевойПанели.SelectedIndex == 2 || НаличиеТорцевойПанели.SelectedIndex == 3) { try { if (!(PartsGenerationChk.IsChecked == true & BackPanels.IsChecked != true)) { List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelBack2 = modelSw.PanelsFramelessStr( typeOfPanel: typeOfBackPanel, width: Convert.ToString(height - 40), height: Convert.ToString(width - 40), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: _panelBack, isLeftSide: leftSide, расположениеПанелей: "", покрытие: покрытие, расположениеВставок: "", первыйТип: null, типТорцевой: ParmsOfBackPanel2(), типДвойной: "00", screws: screwsBackPanel, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Логгер.Ошибка( ex.Message, ex.StackTrace, ex.TargetSite.ToString(), "FramelessUnitUc"); } } #endregion var panelBack = new[] {panelBack1, panelBack2}; try { if (!(PartsGenerationChk.IsChecked == true & UpPanels.IsChecked != true)) { List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelUp = modelSw.PanelsFramelessStr( typeOfPanel: new[] { ТипВерхнейПанели.Text, КришаТип.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипВерхнейПанели.Text)) }, width: Convert.ToString(lenght), height: Convert.ToString(width), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: PanelUpChk.IsChecked == true, isLeftSide: leftSide, расположениеПанелей: PanelsConfig(), покрытие: покрытие, расположениеВставок: ProfilsConfig(), первыйТип: null, типТорцевой: ParmsOfRoofPanelFlange(), типДвойной: typeOfDoubleStrКриша, screws: new ModelSw.Screws { ByWidth = ironwares.ScrewsByLenght, ByHeight = ironwares.ScrewsByWidth, ByWidthInner = typeOfDoubleStrНесъемнаяПанель.Contains("1") ? ironwares.ScrewsByLenght - 1000 > 2000 ? ironwares.ScrewsByLenght - 2000 : ironwares.ScrewsByLenght - 1000 : ironwares.ScrewsByLenght - 1000, ByHeightInner = ironwares.ScrewsByWidth - 1000 }, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); foreach (var partName in partsToDeleteList) { modelSw.PartsToDeleteList.Add(new KeyValuePair<string, string>(@panelUp, partName)); } addingConstructParameters.PanelsToDelete = new List<string>(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Логгер.Ошибка( ex.Message, ex.StackTrace, ex.TargetSite.ToString(), "FramelessUnitUc"); } #region Панель нижняя под монтажные ножки try { if (!(PartsGenerationChk.IsChecked == true & DownPanels.IsChecked != true)) { //const string paneltype = "Панель нижняя под монтажные ножки"; List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelDown = modelSw.PanelsFramelessStr( typeOfPanel: new[] { ТипПанелиНижней.Text, ОпорнаяЧастьТип.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипПанелиНижней.Text)) }, width: Convert.ToString(lenght), height: Convert.ToString(width), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: PanelDownChk.IsChecked == true, isLeftSide: !leftSide, // REVERSE расположениеПанелей: PanelsConfig(), покрытие: покрытие, расположениеВставок: ProfilsConfig(), первыйТип: null, типТорцевой: ParmsOfMontagePanelFlange(), типДвойной: typeOfDoubleStrОпорнаяЧасть, screws: new ModelSw.Screws { ByWidth = ironwares.ScrewsByLenght, ByHeight = ironwares.ScrewsByWidth, ByWidthInner = typeOfDoubleStrНесъемнаяПанель.Contains("1") ? ironwares.ScrewsByLenght - 1000 > 2000 ? ironwares.ScrewsByLenght - 2000 : ironwares.ScrewsByLenght - 1000 : ironwares.ScrewsByLenght - 1000, ByHeightInner = ironwares.ScrewsByWidth - 1000 }, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); foreach (var partName in partsToDeleteList) { modelSw.PartsToDeleteList.Add(new KeyValuePair<string, string>(@panelDown, partName)); } } } catch (Exception ex) { Логгер.Ошибка(ex.Message, ex.StackTrace, ex.TargetSite.ToString(), "FramelessUnitUc"); } #endregion #region Съемная и усиливающие панели var panelRemovable = new[] {""}; string panelRemovable1 = null; string panelRemovable2 = null; string panelRemovable3 = null; try { //"Съемная"; try { if (!(PartsGenerationChk.IsChecked == true & RemPanels.IsChecked != true)) { List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelRemovable1 = modelSw.PanelsFramelessStr( typeOfPanel: new[] { ТипСъемнойПанели1.SelectedValue.ToString(), ТипСъемнойПанели1.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипСъемнойПанели1.SelectedValue.ToString())) }, width: Convert.ToString(ШиринаСъемнойПанели1.Text), height: Convert.ToString(height - 40), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: УсилениеСъемнойПанели1.IsChecked == true, isLeftSide: false, расположениеПанелей: "", покрытие: покрытие, расположениеВставок: null, первыйТип: null, типТорцевой: null, типДвойной: "00", screws: null, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); } } catch (Exception exception) { MessageBox.Show(exception.ToString()); } try { if (!(PartsGenerationChk.IsChecked == true & RemPanels.IsChecked != true)) { List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelRemovable2 = modelSw.PanelsFramelessStr( typeOfPanel: new[] { ТипСъемнойПанели2.SelectedValue.ToString(), ТипСъемнойПанели2.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипСъемнойПанели2.SelectedValue.ToString())) }, width: Convert.ToString(ШиринаСъемнойПанели2.Text), height: Convert.ToString(height - 40), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: УсилениеСъемнойПанели2.IsChecked == true, isLeftSide: false, расположениеПанелей: "", покрытие: покрытие, расположениеВставок: null, первыйТип: null, типТорцевой: null, типДвойной: "00", screws: null, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); } } catch (Exception exception) { MessageBox.Show(exception.ToString()); } try { if (!(PartsGenerationChk.IsChecked == true & RemPanels.IsChecked != true)) { List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelRemovable3 = modelSw.PanelsFramelessStr( typeOfPanel: new[] { ТипСъемнойПанели3.SelectedValue.ToString(), ТипСъемнойПанели3.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипСъемнойПанели3.SelectedValue.ToString())) }, width: Convert.ToString(ШиринаСъемнойПанели3.Text), height: Convert.ToString(height - 40), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: УсилениеСъемнойПанели3.IsChecked == true, isLeftSide: false, расположениеПанелей: "", покрытие: покрытие, расположениеВставок: null, первыйТип: null, типТорцевой: null, типДвойной: "00", screws: null, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); } } catch (Exception exception) { MessageBox.Show(exception.ToString()); } #region Усиливющие панели string panelReinforcing1 = null; string panelReinforcing2 = null; if (ТипУсилПанели1.Visibility == Visibility.Visible) { try { if (!(PartsGenerationChk.IsChecked == true & StrenghtPanels.IsChecked != true)) { var typeOfPanel = ТипУсилПанели1.SelectedItem as ComboBoxItem; List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelReinforcing1 = modelSw.PanelsFramelessStr( typeOfPanel: new[] { ТипУсилПанели1.SelectedValue.ToString(), ТипУсилПанели1.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипУсилПанели1.SelectedValue.ToString())) }, width: Convert.ToString(130), height: Convert.ToString(height - 40), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: false, isLeftSide: false, расположениеПанелей: "", покрытие: покрытие, расположениеВставок: null, первыйТип: new[] { ТипНесъемнойПанели.SelectedValue.ToString(), ТипНесъемнойПанели.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипНесъемнойПанели.SelectedValue.ToString())) }, типТорцевой: null, типДвойной: "00", screws: null, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); } } catch (Exception e) { MessageBox.Show(e.ToString()); } } if (ТипУсилПанели2.Visibility == Visibility.Visible) { try { if (!(PartsGenerationChk.IsChecked == true & StrenghtPanels.IsChecked != true)) { var typeOfPanel = ТипУсилПанели2.SelectedItem as ComboBoxItem; List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelReinforcing2 = modelSw.PanelsFramelessStr( typeOfPanel: new[] { ТипУсилПанели2.SelectedValue.ToString(), ТипУсилПанели2.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипУсилПанели2.SelectedValue.ToString())) }, width: Convert.ToString(130), height: Convert.ToString(height - 40), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: false, isLeftSide: false, расположениеПанелей: "", покрытие: покрытие, расположениеВставок: null, первыйТип: new[] { ТипНесъемнойПанели.SelectedValue.ToString(), ТипНесъемнойПанели.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипНесъемнойПанели.SelectedValue.ToString())) }, типТорцевой: null, типДвойной: "00", screws: null, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); } } catch (Exception exception) { MessageBox.Show(exception.ToString()); } } #endregion panelRemovable = new[] { panelRemovable1, panelRemovable2, panelRemovable3, ПрименениеСкотча.Text, panelReinforcing1, panelReinforcing2 }; } catch (Exception ex) { MessageBox.Show(ex.ToString()); Логгер.Ошибка( logText: ex.Message, код: ex.StackTrace, функция: ex.TargetSite.ToString(), className: "FramelessUnitUc"); } #endregion try { if (!(PartsGenerationChk.IsChecked == true & UnremPanels.IsChecked != true)) { //"Несъемная"; List<ModelSw.ExistingAsmsAndParts> existingAsmsAndParts; panelFixed = modelSw.PanelsFramelessStr( typeOfPanel: new[] { ТипНесъемнойПанели.SelectedValue.ToString(), ТипНесъемнойПанели.Text, Convert.ToString(SqlBaseData.PanelsTypeId(ТипНесъемнойПанели.SelectedValue.ToString())) }, width: Convert.ToString(lenght), height: Convert.ToString(height - 40), materialP1: materialP1, materialP2: materialP2, скотч: ПрименениеСкотча.Text, усиление: PanelUnremChk.IsChecked == true, isLeftSide: false, расположениеПанелей: "", покрытие: покрытие, расположениеВставок: ProfilsConfig(), первыйТип: null, типТорцевой: ParmsOfUnRemPanelFlange(), типДвойной: typeOfDoubleStrНесъемнаяПанель, screws: new ModelSw.Screws { ByWidth = typeOfDoubleStrНесъемнаяПанель.Contains("1") ? ironwares.ScrewsByLenght - 1000 > 2000 ? ironwares.ScrewsByLenght - 2000 : ironwares.ScrewsByLenght - 1000 : ironwares.ScrewsByLenght - 1000, ByHeight = ironwares.ScrewsByHeight, ByWidthInner = ironwares.ScrewsByLenght, ByHeightInner = ironwares.ScrewsByHeight - 1000, ByWidthInnerUp = ironwares.ScrewsByLenght }, partsToDeleteList: out partsToDeleteList, existingAsmsAndParts: out existingAsmsAndParts, onlySearch: onlySearch.IsChecked == true); existingAsmsAndParts2.AddRange(existingAsmsAndParts); foreach (var partName in partsToDeleteList) { modelSw.PartsToDeleteList.Add(new KeyValuePair<string, string>(@panelFixed, partName)); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Логгер.Ошибка( ex.Message, ex.StackTrace, ex.TargetSite.ToString(), "FramelessUnitUc"); } #endregion if (ТипПроф1.Visibility != Visibility.Visible){ТипПроф1.Text = "-";} if (ТипПроф2.Visibility != Visibility.Visible){ТипПроф2.Text = "-";} if (ТипПроф3.Visibility != Visibility.Visible){ТипПроф3.Text = "-";} if (ТипПроф4.Visibility != Visibility.Visible){ТипПроф4.Text = "-";} string[] profils = null; { try { profils = new[] { ТипПроф1.Text == "-" ? "-" : modelSw.Profil(Convert.ToDouble(HeightU.Text) - 80, ТипПроф1.Text, ironwares.ScrewsByHeight + 1000), ТипПроф2.Text == "-" ? "-" : modelSw.Profil(Convert.ToDouble(HeightU.Text) - 80, ТипПроф2.Text, ironwares.ScrewsByHeight + 1000), ТипПроф3.Text == "-" ? "-" : modelSw.Profil(Convert.ToDouble(HeightU.Text) - 80, ТипПроф3.Text, ironwares.ScrewsByHeight + 1000), ТипПроф4.Text == "-" ? "-" : modelSw.Profil(Convert.ToDouble(HeightU.Text) - 80, ТипПроф4.Text, ironwares.ScrewsByHeight + 1000) }; } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } } try { if (OnlyFind) { PartsPdmTable.ItemsSource = existingAsmsAndParts2; var asmsAndParts = new ModelSw.ExistingAsmsAndParts(); foreach (var existingAsmsAndPartse in existingAsmsAndParts2) { if (existingAsmsAndPartse == null) return; existingAsmsAndPartse.PartPath = asmsAndParts.GetPath(existingAsmsAndPartse?.PartName, Settings.Default.PdmBaseName); existingAsmsAndPartse.ExistInSistem = string.IsNullOrEmpty(existingAsmsAndPartse?.PartPath) ? "Нет" : "Есть"; } PartsPdmTable.ItemsSource = existingAsmsAndParts2; return; } } catch (Exception) { // ignored } var dimensions = new ModelSw.BlockDimensions { Width = width, Height = height, Lenght = lenght, DimO1 = Отступ1.Visibility == Visibility.Visible ? (Convert.ToDouble(Отступ1.Text) - 46) : 0, DimO2 = Отступ2.Visibility == Visibility.Visible ? Convert.ToDouble(Отступ2.Text) - 132 : 0, DimO3 = Отступ3.Visibility == Visibility.Visible ? Convert.ToDouble(Отступ3.Text) - 132 : 0, Planel1Width = ШиринаПанели1.Visibility == Visibility.Visible ? Convert.ToDouble(ШиринаПанели1.Text) : 0, Planel2Width = ШиринаПанели2.Visibility == Visibility.Visible ? Convert.ToDouble(ШиринаПанели2.Text) : 0, Planel3Width = ШиринаПанели3.Visibility == Visibility.Visible ? Convert.ToDouble(ШиринаПанели3.Text) : 0 #region To delete //PlanelCentrDoor1 = dimO1 + remPanelWidth1 / 2, //PlanelCentrDoor2 = dimO1 + remPanelWidth1 + dimO2 + remPanelWidth2 / 2, //PlanelCentrDoor3 = dimO1 + remPanelWidth1 + dimO2 + remPanelWidth2 + dimO3 + remPanelWidth3 / 2 #endregion }; if (PartsGenerationChk.IsChecked == true) { modelSw.DeleteAllPartsToDelete(); return; } modelSw.FramelessBlock( size: ((DataRowView) SizeOfUnit.SelectedItem)["Type"].ToString(), order: OrderTextBox.Text, leftSide: leftSide, section: SectionTextBox.Text, pDown: panelDown, pFixed: panelFixed, pUp: panelUp, съемныеПанели: panelRemovable, промежуточныеСтойки: profils, dimensions: dimensions, троцевыеПанели: panelBack); //m1: //MessageBox.Show("Delete All Parts 2"); modelSw.DeleteAllPartsToDelete(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Логгер.Ошибка(logText: ex.Message, код: ex.StackTrace, функция: ex.TargetSite.ToString(), className: "FramelessUnitUc"); } Логгер.Информация($"Построение бескаркасной уставновки завершено - {""}", "", "", "FramelessUnitUc"); }
void Button_Click(object sender, RoutedEventArgs e) { var modelSw = new ModelSw(); modelSw.Profil(Convert.ToDouble(HeightU.Text) - 40, "03", null); }
void BuildDamper_Click(object sender, RoutedEventArgs e) { var mat1Code = ""; var viewRowMat1 = (DataRowView)MaterialP1.SelectedItem; var row1 = viewRowMat1.Row; if (row1 != null) { mat1Code = row1.Field <string>("CodeMaterial"); } var materialP1 = new[] { MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code }; //goto m2; #region ModelSw try { #region CodeMaterial //var mat1Code = ""; //var viewRowMat1 = (DataRowView)MaterialP1.SelectedItem; //var row1 = viewRowMat1.Row; //if (row1 != null) // mat1Code = row1.Field<string>("CodeMaterial"); //var materialP1 = new[] { MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code }; //var vcad = new VentsCadLibrary.VentsCad //{ // ConnectionToSql = Settings.Default.ConnectionToSQL, // DestVaultName = Settings.Default.TestPdmBaseName, // VaultName = Settings.Default.PdmBaseName //}; //string unit; //vcad.DumperS(TypeOfDumper.Text, WidthDamper.Text, HeightDamper.Text, (IsOutDoor.IsChecked == true), materialP1, out unit, false); //MessageBox.Show("Finish"); //return; #endregion var sw = new ModelSw(); sw.Dumper(TypeOfDumper.Text, WidthDamper.Text, HeightDamper.Text, (IsOutDoor.IsChecked == true), materialP1); } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); } return; #endregion m1: //VentsCadLibrary try { using (var server = new VentsCadLibrary.VentsCad()) { var newDumper = new VentsCadLibrary.VentsCad.Dumper(TypeOfDumper.Text, WidthDamper.Text, HeightDamper.Text, (IsOutDoor.IsChecked == true), materialP1); if (!newDumper.Exist) { newDumper.Build(); } var place = newDumper.GetPlace(); MessageBox.Show(place.Path + "\n" + place.IdPdm + "\n" + place.ProjectId); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return; m2: // VentsCadService MessageBox.Show("VentsCadService"); try { var serv = new ServiceV( new VentsCadService.Parameters { Name = "dumper", Type = new VentsCadService.Type { SubType = TypeOfDumper.Text }, Sizes = new VentsCadService.Sizes[] { new VentsCadService.Sizes { Width = WidthDamper.Text, Height = HeightDamper.Text } }, Materials = new VentsCadService.Material[] { new VentsCadService.Material { Code = materialP1[3], Name = materialP1[2], Thikness = materialP1[1], Value = materialP1[0], } } }); var Build = new Task(serv.build); Build.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void UserControl_Loaded_1(object sender, RoutedEventArgs e) { _bw.DoWork += ((o, args) => { Dispatcher.Invoke(DispatcherPriority.Background, EmptyDelegate); // Dispatcher.Thread.SetApartmentState(new ApartmentState()); Dispatcher.InvokeAsync(() => { try { var sw = new ModelSw(); if (Unit50Full.IsChecked == true) { if (FrameOffset.Text == "") { try { FrameOffset.Text = Convert.ToString(Convert.ToDouble(Lenght.Text) / 2); } catch (Exception) { FrameOffset.Text = Convert.ToString(Convert.ToDouble(Lenght.Text) / 2); } } //Dispatcher.Invoke( // () => // sw.UnitAsmbly(SizeOfUnit.Text, "00", "",WidthU.Text, HeightU.Text, // Lenght.Text, Thikness.Text, TypeOfFrame.Text, // FrameOffset.Text, new[] { null, TypeOfPanel50.Text }, MaterialP1.Text, MaterialP2.Text, "", "")); //// Parallel.Invoke(() => sw.UnitAsmbly(SizeOfUnit.Text, "00", WidthU.Text, HeightU.Text, Lenght.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text)); //sw.UnitAsmbly(SizeOfUnit.Text, "00", WidthU.Text, HeightU.Text, // Lenght.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text); } else if (MontageFrame50.IsChecked == true) { if (FrameOffset.Visibility == Visibility.Collapsed & LenghtBaseFrame.Text != "") { try { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } catch (Exception) { FrameOffset.Text = Convert.ToString(150); } } sw.MontageFrame(WidthBaseFrame.Text, LenghtBaseFrame.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text, MaterialMontageFrame.Text, null); } else if (TypeOfUnit50.IsChecked == true) { } else if (Panel50.IsChecked == true) { sw.Panels50Build( new[] { null, TypeOfPanel50.Text }, WidthPanel.Text, HeightPanel.Text, new[] { "Az", null }, new[] { "Az", null }, null); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }); }); //Dispatcher.Thread.SetApartmentState(new ApartmentState()); Dispatcher.InvokeAsync(() => { //var sw = new ModelSw(); //sw.CreateDistDirectory(string.Format(@"{0}\{1}", @Properties.Settings.Default.DestinationFolder, // sw.Unit50Folder)); //sw.CreateDistDirectory(string.Format(@"{0}\{1}", @Properties.Settings.Default.DestinationFolder, // sw.Panel50DestinationFolder)); //sw.CreateDistDirectory(string.Format(@"{0}\{1}", @Properties.Settings.Default.DestinationFolder, // sw.BaseFrameDestinationFolder)); }); }
private void Button_Click_2(object sender, RoutedEventArgs e) { var sw = new ModelSw(); sw.ReubildAllOpenedDocs(); }
private void Button_Click_2(object sender, RoutedEventArgs e) { var sw = new ModelSw(); sw.ReubildAllOpenedDocs(); }
void BUILDING_Click(object sender, RoutedEventArgs e) { if (LenghtBaseFrame.Text == "") return; if (FrameOffset.Text == "") { try { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } catch (Exception) { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } } //goto m2; //ModelSw var sw = new ModelSw(); sw.MontageFrame( WidthBaseFrame.Text, LenghtBaseFrame.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text, MaterialMontageFrame.SelectedValue.ToString(), new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral1.SelectedValue?.ToString() ?? "" }); FrameOffset.Text = ""; return; m1: // VentsCadLibrary try { using (var server = new VentsCadLibrary.VentsCad()) { var newDumper = new VentsCadLibrary.VentsCad.MontageFrame(TypeOfFrame.Text, WidthBaseFrame.Text, LenghtBaseFrame.Text, FrameOffset.Text, new VentsCadLibrary.VentsCad.ProductFactory.Material { Name = MaterialMontageFrame.Text, Thikness = Thikness.Text, Value = MaterialMontageFrame.SelectedValue.ToString(), }); if (!newDumper.Exist) { newDumper.Build(); } var place = newDumper.GetPlace(); MessageBox.Show(place.Path + "\n" + place.IdPdm + "\n" + place.ProjectId); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return; m2: // VentsCadService MessageBox.Show("VentsCadService"); try { var serv = new ServiceV( new VentsCadService.Parameters { Name = "montageFrame", Type = new VentsCadService.Type { SubType = TypeOfFrame.Text }, Sizes = new VentsCadService.Sizes[] { new VentsCadService.Sizes { Width = TypeOfFrame.Text, Lenght = WidthBaseFrame.Text, Additional1 = FrameOffset.Text } }, Materials = new VentsCadService.Material[] { new VentsCadService.Material { Name = MaterialMontageFrame.Text, Thikness = Thikness.Text, Value = MaterialMontageFrame.SelectedValue.ToString(), } } }); var Build = new Task(serv.build); Build.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } FrameOffset.Text = ""; }
void BUILDING_Click(object sender, RoutedEventArgs args) { var sw = new ModelSw(); switch (thicknessOfPanel) { case "30": var frame = ""; try { if (MontageFrame50.IsChecked == true) { if (FrameOffset.Text == "") { try { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } catch (Exception) { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } } frame = sw.MontageFrameS( WidthBaseFrame.Text, LenghtBaseFrame.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text, MaterialMontageFrame.SelectedValue.ToString(), new[] { RalFrame1.Text, CoatingTypeFrame1.Text, CoatingClassFrame1.Text, RalFrame1.SelectedValue?.ToString() ?? "" }, true); FrameOffset.Text = ""; } var mat1Code = ""; var mat2Code = ""; var viewRowMat1 = (DataRowView)MaterialP1.SelectedItem; var row1 = viewRowMat1.Row; if (row1 != null) { mat1Code = row1.Field <string>("CodeMaterial"); } var viewRowMat2 = (DataRowView)MaterialP2.SelectedItem; var row2 = viewRowMat2.Row; if (row2 != null) { mat2Code = row2.Field <string>("CodeMaterial"); } #region Панели var materialP1 = new[] { MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code }; var materialP2 = new[] { MaterialP2.SelectedValue.ToString(), ТолщинаВннутренней.Text, MaterialP2.Text, mat2Code }; string panelWxL = null; string panelHxL = null; string panelHxL04 = null; if (Panel50.IsChecked == true) { try { //Верх - Низ try { sw.Panels30Build( typeOfPanel: new[] { SqlBaseData.PanelsTable().Rows[0][2].ToString(), SqlBaseData.PanelsTable().Rows[0][1].ToString(), "30" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - 60), height: Convert.ToString(Convert.ToInt32(WidthU.Text) - 60), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, path: out panelWxL); } catch (Exception) { // ignored } //Несъемная try { sw.Panels30Build( typeOfPanel: new[] { SqlBaseData.PanelsTable().Rows[0][2].ToString(), SqlBaseData.PanelsTable().Rows[0][1].ToString(), "30" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - 60), height: Convert.ToString(Convert.ToInt32(HeightU.Text) - 60), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, path: out panelHxL); } catch (Exception) { // ignored } //Cъемная try { sw.Panels30Build( typeOfPanel: new[] { TypeOfPanel50.SelectedValue.ToString(), TypeOfPanel50.Text, "30" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - 60), height: Convert.ToString(Convert.ToInt32(HeightU.Text) - 60), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, path: out panelHxL04); } catch (Exception e) { MessageBox.Show(e.ToString()); } } catch (Exception e) { MessageBox.Show(e.ToString()); } } #endregion var panels = new[] { panelWxL, panelHxL, panelHxL04 }; var roofType = TypeOfRoof.Text; if (RoofOfUnit50.IsChecked != true) { roofType = ""; } sw.UnitAsmbly30(((DataRowView)SizeOfUnit.SelectedItem)["Type"].ToString(), OrderTextBox.Text, SideService.Text, WidthU.Text, HeightU.Text, Lenght.Text, frame, panels, roofType, "Section " + SectionTextBox.Text); } catch (Exception e) { MessageBox.Show(e.Message); } break; default: frame = ""; try { if (MontageFrame50.IsChecked == true) { if (FrameOffset.Text == "") { try { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } catch (Exception) { FrameOffset.Text = Convert.ToString((Convert.ToDouble(LenghtBaseFrame.Text) / 2)); } } frame = sw.MontageFrameS( WidthBaseFrame.Text, LenghtBaseFrame.Text, Thikness.Text, TypeOfFrame.Text, FrameOffset.Text, MaterialMontageFrame.SelectedValue.ToString(), new[] { RalFrame1.Text, CoatingTypeFrame1.Text, CoatingClassFrame1.Text, RalFrame1.SelectedValue?.ToString() ?? "" }, true); FrameOffset.Text = ""; } var mat1Code = ""; var mat2Code = ""; var viewRowMat1 = (DataRowView)MaterialP1.SelectedItem; var row1 = viewRowMat1.Row; if (row1 != null) { mat1Code = row1.Field <string>("CodeMaterial"); } var viewRowMat2 = (DataRowView)MaterialP2.SelectedItem; var row2 = viewRowMat2.Row; if (row2 != null) { mat2Code = row2.Field <string>("CodeMaterial"); } #region Панели var materialP1 = new[] { MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code }; var materialP2 = new[] { MaterialP2.SelectedValue.ToString(), ТолщинаВннутренней.Text, MaterialP2.Text, mat2Code }; string panelWxL = null; string panelHxL = null; string panelHxL04 = null; var panelsDelta = TypeOfPanel.SelectedIndex == 0 ? 100 : 140; if (Panel50.IsChecked == true) { try { //Верх - Низ try { panelWxL = sw.Panels50BuildStr( typeOfPanel: new[] { SqlBaseData.PanelsTable().Rows[0][2].ToString(), SqlBaseData.PanelsTable().Rows[0][1].ToString(), TypeOfPanel.SelectedIndex == 0 ? "50":"70" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - panelsDelta), height: Convert.ToString(Convert.ToInt32(WidthU.Text) - panelsDelta), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, onlyPath: true); } catch (Exception) { // } //Несъемная try { panelHxL = sw.Panels50BuildStr( typeOfPanel: new[] { SqlBaseData.PanelsTable().Rows[0][2].ToString(), SqlBaseData.PanelsTable().Rows[0][1].ToString(), TypeOfPanel.SelectedIndex == 0 ? "50":"70" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - panelsDelta), height: Convert.ToString(Convert.ToInt32(HeightU.Text) - panelsDelta), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, onlyPath: true); } catch (Exception) { // } //Cъемная try { panelHxL04 = sw.Panels50BuildStr( typeOfPanel: new[] { TypeOfPanel50.SelectedValue.ToString(), TypeOfPanel50.Text, TypeOfPanel.SelectedIndex == 0 ? "50":"70" }, width: Convert.ToString(Convert.ToInt32(Lenght.Text) - panelsDelta), height: Convert.ToString(Convert.ToInt32(HeightU.Text) - panelsDelta), materialP1: materialP1, materialP2: materialP2, покрытие: new[] { Ral1.Text, CoatingType1.Text, CoatingClass1.Text, Ral2.Text, CoatingType2.Text, CoatingClass2.Text, Ral1.SelectedValue?.ToString() ?? "", Ral2.SelectedValue?.ToString() ?? "" }, onlyPath: true); } catch (Exception e) { MessageBox.Show(e.ToString()); } } catch (Exception e) { MessageBox.Show(e.ToString()); } } #endregion var panels = new[] { panelWxL, panelHxL, panelHxL04 }; var roofType = TypeOfRoof.Text; if (RoofOfUnit50.IsChecked != true) { roofType = ""; } sw.UnitAsmbly(((DataRowView)SizeOfUnit.SelectedItem)["Type"].ToString(), OrderTextBox.Text, SideService.Text, WidthU.Text, HeightU.Text, Lenght.Text, frame, panels, roofType, "Section " + SectionTextBox.Text, thicknessOfPanel == "50" ? "150" : "170"); } catch (Exception e) { MessageBox.Show(e.Message); } break; } }