private void FillListView() { try { // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // get all cardboard profiles DCCardboardProfile[] profiles = client.GetAllCardboardProfile(); // fill list view listViewProfile.Items.Clear(); foreach (DCCardboardProfile profile in profiles) { ListViewItem item = new ListViewItem(); item.Tag = profile.ID; item.Text = profile.Name; item.SubItems.Add(profile.Code); item.SubItems.Add(string.Format("{0}", profile.Thickness)); listViewProfile.Items.Add(item); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void UpdateMajorationValues() { // retrieve majoration from database PLMPackServiceClient client = WCFClientSingleton.Instance.Client; Dictionary <string, double> dictMajo = new Dictionary <string, double>(); DCMajorationSet majoSet = client.GetMajorationSet(_compGuid, CurrentProfile); foreach (DCMajoration majo in majoSet.Majorations) { dictMajo.Add(majo.Name, majo.Value); } // update nud control values foreach (Control ctrl in Controls) { NumericUpDown nud = ctrl as NumericUpDown; if (null == nud || !nud.Name.StartsWith("nud_")) { continue; } if (dictMajo.ContainsKey(nud.Name.Substring(4))) { decimal v = (decimal)dictMajo[nud.Name.Substring(4)]; if (nud.Minimum < v && v < nud.Maximum) { nud.Value = v; } } nud.MouseEnter += new EventHandler(nud_MouseEnter); nud.ValueChanged += new EventHandler(nud_ValueChanged); } _dirty = false; }
private void onSendToDatabase(object sender, EventArgs e) { try { FormSetItemName form = new FormSetItemName() { ItemName = ItemName }; if (DialogResult.OK == form.ShowDialog()) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewPalletCorner(new DCSBPalletCorner() { Name = form.ItemName, Description = ItemDescription, UnitSystem = (int)UnitsManager.CurrentUnitSystem, Length = CornerLength, Width = CornerWidth, Thickness = CornerThickness, Weight = CornerWeight, Color = CornerColor.ToArgb(), AutoInsert = false } ); Close(); } } catch (Exception ex) { _log.Error(ex.Message); } }
private void onUserAdd(object sender, EventArgs e) { try { // does user belong to group ? foreach (object o in listboxUsers.Items) { DCUser user = o as DCUser; if (null != user && string.Equals(tbUserToAdd.Text, user.Name, StringComparison.CurrentCultureIgnoreCase)) { MessageBox.Show(string.Format("User '{0}' already member of group {1}!", user.Name)); return; } } PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // does user exist if (!client.UserExists(tbUserToAdd.Text)) { MessageBox.Show(string.Format("User '{0}' does not exist!")); return; } // add user to group client.AddUserToCurrentGroup(tbUserToAdd.Text); tbUserToAdd.Text = string.Empty; FillUserList(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void onSendToDatabase(object sender, EventArgs e) { try { FormSetItemName form = new FormSetItemName() { ItemName = ItemName }; if (DialogResult.OK == form.ShowDialog()) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewCylinder(new DCSBCylinder() { Name = form.ItemName, Description = ItemDescription, UnitSystem = (int)UnitsManager.CurrentUnitSystem, RadiusOuter = RadiusOuter, RadiusInner = RadiusInner, Height = CylinderHeight, Weight = Weight, NetWeight = this.NetWeight.Activated ? this.NetWeight.Value : new Nullable <double>(), ColorOuter = ColorWallOuter.ToArgb(), ColorInner = ColorWallInner.ToArgb(), ColorTop = ColorTop.ToArgb(), AutoInsert = false } ); Close(); } } catch (Exception ex) { _log.Error(ex.Message); } }
private void onSendToDatabase(object sender, EventArgs e) { try { FormSetItemName form = new FormSetItemName() { ItemName = ItemName }; if (DialogResult.OK == form.ShowDialog()) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewTruck(new DCSBTruck() { Name = form.ItemName, Description = ItemDescription, UnitSystem = (int)UnitsManager.CurrentUnitSystem, DimensionsInner = new DCSBDim3D() { M0 = TruckLength, M1 = TruckWidth, M2 = TruckHeight }, AdmissibleLoad = TruckAdmissibleLoadWeight, Color = TruckColor.ToArgb(), AutoInsert = false } ); Close(); } } catch (Exception ex) { _log.Error(ex.Message); } }
private void onSendToDB(object sender, EventArgs e) { try { FormSetItemName form = new FormSetItemName() { ItemName = ItemName }; if (DialogResult.OK == form.ShowDialog()) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewPallet(new DCSBPallet() { Name = form.ItemName, Description = ItemDescription, UnitSystem = (int)UnitsManager.CurrentUnitSystem, PalletType = PalletTypeName, Dimensions = new DCSBDim3D() { M0 = PalletLength, M1 = PalletWidth, M2 = PalletHeight }, Weight = Weight, AdmissibleLoad = AdmissibleLoad, Color = PalletColor.ToArgb(), AutoInsert = false } ); } } catch (Exception ex) { _log.Error(ex.Message); } }
private void bnDelete_Click(object sender, EventArgs e) { try { if (listViewCardboardFormats.SelectedIndices.Count > 0) { // delete selected cardboard profile int iSel = this.listViewCardboardFormats.SelectedIndices[0]; ListViewItem item = listViewCardboardFormats.Items[iSel]; // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // get selected cardboard format and remove DCCardboadFormat cf = client.GetCardboardFormatByID((int)item.Tag); if (null != cf) { client.RemoveCardboardFormat(cf); } // fill list view again FillListView(); // select first item if (listViewCardboardFormats.Items.Count > 0) { listViewCardboardFormats.Items[0].Selected = true; } } } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void FillListView() { try { // clear all existing items listViewCardboardFormats.Items.Clear(); PLMPackServiceClient client = WCFClientSingleton.Instance.Client; DCCardboadFormat[] cardboardFormats = client.GetAllCardboardFormats(); foreach (DCCardboadFormat cf in cardboardFormats) { ListViewItem item = new ListViewItem(); item.Text = cf.Name; item.SubItems.Add(cf.Description); item.SubItems.Add(string.Format("{0}", cf.Length)); item.SubItems.Add(string.Format("{0}", cf.Width)); item.Tag = cf.ID; listViewCardboardFormats.Items.Add(item); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void onSendToDatabase(object sender, EventArgs e) { try { FormSetItemName form = new FormSetItemName() { ItemName = BundleName }; if (DialogResult.OK == form.ShowDialog()) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewBundle(new DCSBBundle() { Name = form.ItemName, Description = Description, UnitSystem = (int)UnitsManager.CurrentUnitSystem, DimensionsUnit = new DCSBDim3D() { M0 = BundleLength, M1 = BundleWidth, M2 = UnitThickness }, Number = NoFlats, UnitWeight = UnitWeight, Color = Color.ToArgb(), AutoInsert = false } ); Close(); } } catch (Exception ex) { _log.Error(ex.Message); } }
private void onSendToDatabase(object sender, EventArgs e) { try { FormSetItemName form = new FormSetItemName() { ItemName = ItemName }; if (DialogResult.OK == form.ShowDialog()) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewPalletFilm(new DCSBPalletFilm() { Name = form.ItemName, Description = ItemDescription, UnitSystem = (int)UnitsManager.CurrentUnitSystem, UseTransparency = this.UseTransparency, UseHatching = this.UseHatching, HatchingSpace = HatchSpacing, HatchingAngle = HatchAngle, Color = FilmColor.ToArgb(), AutoInsert = false } ); Close(); } } catch (Exception ex) { _log.Error(ex.Message); } }
private void SaveMajorationValues() { List <DCMajoration> listMajo = new List <DCMajoration>(); foreach (Control ctrl in Controls) { NumericUpDown nud = ctrl as NumericUpDown; if (null == nud) { continue; } if (nud.Name.Contains("nud_m")) { listMajo.Add(new DCMajoration() { Name = nud.Name.Substring(4), Value = Convert.ToDouble(nud.Value) }); } } PLMPackServiceClient client = WCFClientSingleton.Instance.Client; DCComponent comp = client.GetComponentByGuid(_compGuid); DCMajorationSet majoSet = new DCMajorationSet() { Profile = CurrentProfile, Majorations = listMajo.ToArray() }; client.UpdateMajorationSet(_compGuid, majoSet); // notify listeners _profileLoader.NotifyModifications(); }
public DCComponent GetComponent(Guid guid) { if (guid != _currentGuid) { _currentGuid = guid; PLMPackServiceClient client = WCFClientSingleton.Instance.Client; _component = client.GetComponentByGuid(guid); } return(_component); }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); // set current group PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // initialize combobox DCGroup gp = cbCurrentGroup.SelectedItem as DCGroup; client.SetCurrentGroup(gp); }
public override void SetComponent(Pic.Plugin.Component comp) { if (null == comp) { return; } // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // retrieve component _compGuid = comp.Guid; BuildCardboardProfile(); }
private bool CanWrite(PLMPackServiceClient client, DataType dt) { DCSBTypeEnum eType = DataTypeToDCSBEnum(dt); int itemID = -1; bool exist = client.ItemExistsID(eType, dt.Name, ref itemID); if (exist && Overwrite) { client.RemoveItemById(eType, itemID); AppendRtb(string.Format(Properties.Resources.ID_REMOVINGEXISTINGTYPE, dt.Name)); } return(!exist || Overwrite); }
private void onSaveToDatabase(object sender, EventArgs e) { try { FormSetItemName form = new FormSetItemName() { ItemName = BoxName }; if (DialogResult.OK == form.ShowDialog()) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // colors int[] colors = new int[6]; for (int i = 0; i < 6; ++i) { colors[i] = _faceColors[i].ToArgb(); } client.CreateNewCase(new DCSBCase() { Name = form.ItemName, Description = Description, UnitSystem = (int)UnitsManager.CurrentUnitSystem, IsCase = (_mode == Mode.MODE_CASE), DimensionsOuter = new DCSBDim3D() { M0 = uCtrlDimensionsOuter.ValueX, M1 = uCtrlDimensionsOuter.ValueY, M2 = uCtrlDimensionsOuter.ValueZ }, HasInnerDims = HasInsideDimensions, DimensionsInner = new DCSBDim3D() { M0 = uCtrlDimensionsInner.X, M1 = uCtrlDimensionsInner.Y, M2 = uCtrlDimensionsInner.Z }, ShowTape = TapeWidth.Activated, TapeWidth = TapeWidth.Value, TapeColor = TapeColor.ToArgb(), Weight = Weight, NetWeight = this.NetWeight.Activated ? this.NetWeight.Value : new Nullable <double>(), Colors = colors, AutoInsert = false } ); } } catch (Exception ex) { _log.Error(ex.Message); } }
public override void BuildCardboardProfile() { // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; DCCardboardProfile[] profiles = client.GetAllCardboardProfile(); _cardboardProfiles.Clear(); foreach (DCCardboardProfile cp in profiles) { _cardboardProfiles.Add(cp.Name, cp); } _majorationList = null; }
private void onUserRemove(object sender, EventArgs e) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // remove selected user from group DCUser user = listboxUsers.SelectedItem as DCUser; if (null != user) { client.RemoveUserFromCurrentGroup(user); } FillUserList(); }
private void onItemNameChanged(object sender, EventArgs e) { string message = string.Empty; PLMPackServiceClient client = WCFClientSingleton.Instance.Client; if (client.ItemExists(DCSBTypeEnum.TTruck, ItemName)) { message = string.Format(Properties.Resources.ID_NAMEALREADYEXISTSINDB, TypeName, ItemName); } statusLbl.ForeColor = string.IsNullOrEmpty(message) ? Color.Black : Color.Red; statusLbl.Text = string.IsNullOrEmpty(message) ? Properties.Resources.ID_READY : message; bnOK.Enabled = string.IsNullOrEmpty(message); }
private void onToInterest(object sender, EventArgs e) { int iSel = lbGroups.SelectedIndex; if (-1 == iSel) { return; } DCGroup gp = lbGroups.Items[iSel] as DCGroup; PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.AddInterest(gp.ID); Refill(); }
private void btCreate_Click(object sender, EventArgs e) { try { FormCreateCardboardFormat form = new FormCreateCardboardFormat(); if (DialogResult.OK == form.ShowDialog()) { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewCardboardFormat(form.FormatName, form.Description, form.FormatWidth, form.FormatHeight); FillListView(); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void FillProfileComboBox(string selectedProfileName) { // initialize profile combo box comboBoxProfile.Items.Clear(); // client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; DCCardboardProfile[] profiles = client.GetAllCardboardProfile(); foreach (DCCardboardProfile cp in profiles) { comboBoxProfile.Items.Add(cp); if (cp.Name == selectedProfileName) { comboBoxProfile.SelectedItem = cp; } } }
protected override Profile[] LoadProfiles() { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; DCCardboardProfile[] profiles = client.GetAllCardboardProfile(); List <Profile> listProfile = new List <Profile>(); foreach (DCCardboardProfile cp in profiles) { listProfile.Add(new Profile(cp.Name)); } if (listProfile.Count > 0) { Selected = listProfile[0]; } return(listProfile.ToArray()); }
private void FillUserList() { // clear all existing items listboxUsers.Items.Clear(); // load all users of group PLMPackServiceClient client = WCFClientSingleton.Instance.Client; DCGroup gp = client.GetCurrentGroup(); foreach (DCUser user in gp.Members) { listboxUsers.Items.Add(user); } // select first item if (listboxUsers.Items.Count > 0) { listboxUsers.SelectedIndex = 0; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // initialize combobox cbCurrentGroup.Items.Clear(); DCGroup[] groups = client.GetUserGroups(); foreach (DCGroup gp in groups) { cbCurrentGroup.Items.Add(gp); if (gp.ID == client.GetUser().GroupID) { cbCurrentGroup.SelectedItem = gp; } } }
public void onToolStripEditComponentCode(object sender, EventArgs e) { try { NodeTag tag = treeView.SelectedNode.Tag as NodeTag; if (null == tag) { return; // no valid tag } if (null == tag.Document) { return; // not a document } string fileExt = tag.Document.File.Extension.ToLower(); if (!string.Equals(fileExt, "dll")) { return; // not a component } string filePath = treeDiM.FileTransfer.FileTransferUtility.DownloadFile(tag.Document.File.Guid, fileExt); // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // output Guid / path Guid outputGuid = Guid.NewGuid(); string outputPath = treeDiM.FileTransfer.FileTransferUtility.BuildPath(outputGuid, fileExt); // form plugin editor FormPluginEditor editorForm = new FormPluginEditor(); editorForm.PluginPath = filePath; editorForm.OutputPath = outputPath; if (DialogResult.OK == editorForm.ShowDialog()) { _log.Info("Component successfully modified!"); // clear component cache in plugin viewer ComponentLoader.ClearCache(); // update pluginviewer pluginViewCtrl.PluginPath = outputPath; } } catch (Exception ex) { _log.Error(ex.ToString()); } }
public static NodeTag[] GetRoot() { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; DCTreeNode[] wrRoot = client.GetRootNodes(); List <NodeTag> nodeTags = new List <NodeTag>(); foreach (DCTreeNode wrNode in wrRoot) { NodeTag nt = new NodeTag(null, wrNode.ID, wrNode.Name, wrNode.Description, (int)wrNode.NodeType, true, //wrNode.HasChildrens, Guid.Empty, string.Empty); nodeTags.Add(nt); } return(nodeTags.ToArray()); }
private void btCreate_Click(object sender, EventArgs e) { try { FormCreateCardboardProfile dlg = new FormCreateCardboardProfile(); if (DialogResult.OK == dlg.ShowDialog()) { // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewCardboardProfile(dlg.ProfileName, dlg.Description, dlg.Code, dlg.Thickness); // fill list view again FillListView(); } } catch (Exception ex) { _log.Debug(ex.ToString()); } }
private void Refill() { PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // groups of interest lbGroupsOfInterest.Items.Clear(); lbGroups.Items.Clear(); // get list of groups DCGroup[] groupsOfInterest = null, groupsOther = null; client.GetGroupsList(chkbAllGroups.Checked, ref groupsOfInterest, ref groupsOther); // fill list box foreach (DCGroup grp in groupsOfInterest) { lbGroupsOfInterest.Items.Add(grp); } foreach (DCGroup grp in groupsOther) { lbGroups.Items.Add(grp); } }