diff --git a/CobXmlSupport/CheckWorkItems.Designer.cs b/CobXmlSupport/CheckWorkItems.Designer.cs index 0714545..144dd9c 100644 --- a/CobXmlSupport/CheckWorkItems.Designer.cs +++ b/CobXmlSupport/CheckWorkItems.Designer.cs @@ -40,9 +40,11 @@ // lbWorkFiles // this.lbWorkFiles.FormattingEnabled = true; - this.lbWorkFiles.Location = new System.Drawing.Point(13, 13); + this.lbWorkFiles.ItemHeight = 16; + this.lbWorkFiles.Location = new System.Drawing.Point(17, 16); + this.lbWorkFiles.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.lbWorkFiles.Name = "lbWorkFiles"; - this.lbWorkFiles.Size = new System.Drawing.Size(198, 355); + this.lbWorkFiles.Size = new System.Drawing.Size(263, 436); this.lbWorkFiles.TabIndex = 0; this.lbWorkFiles.SelectedIndexChanged += new System.EventHandler(this.lbWorkFiles_SelectedIndexChanged); // @@ -54,10 +56,11 @@ this.chDate, this.chFileName, this.chPath}); - this.lvGenFiles.Location = new System.Drawing.Point(209, 13); + this.lvGenFiles.Location = new System.Drawing.Point(279, 16); + this.lvGenFiles.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.lvGenFiles.MultiSelect = false; this.lvGenFiles.Name = "lvGenFiles"; - this.lvGenFiles.Size = new System.Drawing.Size(568, 355); + this.lvGenFiles.Size = new System.Drawing.Size(756, 436); this.lvGenFiles.TabIndex = 1; this.lvGenFiles.UseCompatibleStateImageBehavior = false; this.lvGenFiles.View = System.Windows.Forms.View.Details; @@ -85,22 +88,24 @@ // // btnClose // - this.btnClose.Location = new System.Drawing.Point(706, 374); + this.btnClose.Location = new System.Drawing.Point(941, 460); + this.btnClose.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnClose.Name = "btnClose"; - this.btnClose.Size = new System.Drawing.Size(75, 23); + this.btnClose.Size = new System.Drawing.Size(100, 28); this.btnClose.TabIndex = 2; - this.btnClose.Text = "Stäng"; + this.btnClose.Text = "Close"; this.btnClose.UseVisualStyleBackColor = true; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // // CheckWorkItems // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(789, 408); + this.ClientSize = new System.Drawing.Size(1052, 502); this.Controls.Add(this.btnClose); this.Controls.Add(this.lvGenFiles); this.Controls.Add(this.lbWorkFiles); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "CheckWorkItems"; this.Text = "CheckWorkItems"; this.Load += new System.EventHandler(this.CheckWorkItems_Load); diff --git a/CobXmlSupport/CheckWorkItems.cs b/CobXmlSupport/CheckWorkItems.cs index 9c479d9..2779196 100644 --- a/CobXmlSupport/CheckWorkItems.cs +++ b/CobXmlSupport/CheckWorkItems.cs @@ -92,10 +92,11 @@ namespace CobXmlSupport { ShowCode FileWin = new ShowCode(); FileWin.Parent = null; - FileWin.Labeltext = usageName; + //FileWin.Labeltext = usageName; + FileWin.Labeltext = fname; FileWin.CodeShower.Text = File.ReadAllText(fname); FileWin.ShowDialog(); - + } catch (Exception ex) { diff --git a/CobXmlSupport/GenCobCode.cs b/CobXmlSupport/GenCobCode.cs index 737c45a..1a33a92 100644 --- a/CobXmlSupport/GenCobCode.cs +++ b/CobXmlSupport/GenCobCode.cs @@ -215,6 +215,8 @@ namespace CobXmlSupport Cc = new codeCompleter(cmbLastFile.Text, txtPrefix.Text); Cc.TryFill_In_Dic(); Cc.TryFill_Out_Dic(); + Dictionary FieldList = new Dictionary(); + int objNr = 0; string fieldInCompl = "", fieldOutCompl = ""; foreach (CobRow rw in rowList) @@ -258,6 +260,7 @@ namespace CobXmlSupport } if (rw.Move_FromCode == null) { rw.MoveFromCode = " "; } Cc.WorkDicOut[rw.FieldName] = rw.Move_FromCode; + FieldList.Add(rw.FieldName,objNr++); } // Prefill with possibly filled out code if (chkWrap.Checked) @@ -272,7 +275,35 @@ namespace CobXmlSupport //Debug.WriteLine(rw.TagName); //Debug.WriteLine(rw.Hirarchy); } + string[] jkeys = Cc.WorkDicIn.Keys.ToArray(); + foreach (string jkey in jkeys) + { + int item; + if (!FieldList.TryGetValue(jkey,out item)) + { + string checktxt = ""; + Cc.WorkDicIn.TryGetValue(jkey, out checktxt); + if (checktxt.Trim().Length == 0) + { + Cc.WorkDicIn.Remove(jkey); + } + } + } Cc.Save_In_Dic(); + string[] jkeysOut = Cc.WorkDicOut.Keys.ToArray(); + foreach (string jkey in jkeysOut) + { + int item; + if (!FieldList.TryGetValue(jkey, out item)) + { + string checktxt = ""; + Cc.WorkDicOut.TryGetValue(jkey, out checktxt); + if (checktxt.Trim().Length == 0) + { + Cc.WorkDicOut.Remove(jkey); + } + } + } Cc.Save_Out_Dic(); if (rowList.Count > 0) @@ -2268,16 +2299,16 @@ namespace CobXmlSupport { if (tmpQfh.qualCobRow.MoveFromCode != null && tmpQfh.qualCobRow.Move_FromCode.Trim().Length > 0) { - if (tmpQfh.qualCobRow.MoveFromCode.IndexOf("") > -1 || tmpQfh.qualCobRow.MoveFromCode.IndexOf("") > -1) - { - fromToMoves.CodeShower.Text += " *>" + tmpQfh.qualCobRow.MoveFromCode + "\r\n"; - fromToMoves.CodeShower.Text += " TO " + - (string)(tmpQfh.qualCobRow.FieldDef.ToUpper().Contains("X") ? "MoveToStringVar" : "MoveToNumVar") + "\r\n"; - } - else - { + //if (tmpQfh.qualCobRow.MoveFromCode.IndexOf("") > -1 || tmpQfh.qualCobRow.MoveFromCode.IndexOf("") > -1) + //{ + // fromToMoves.CodeShower.Text += " *>" + tmpQfh.qualCobRow.MoveFromCode + "\r\n"; + // fromToMoves.CodeShower.Text += " TO " + + // (string)(tmpQfh.qualCobRow.FieldDef.ToUpper().Contains("X") ? "MoveToStringVar" : "MoveToNumVar") + "\r\n"; + //} + //else + //{ fromToMoves.CodeShower.Text += tmpQfh.qualCobRow.MoveFromCode + "\r\n"; - } + //} } else { diff --git a/CobXmlSupport/ShowCode.Designer.cs b/CobXmlSupport/ShowCode.Designer.cs index b21824f..1a38085 100644 --- a/CobXmlSupport/ShowCode.Designer.cs +++ b/CobXmlSupport/ShowCode.Designer.cs @@ -31,20 +31,21 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShowCode)); this.btnClose = new System.Windows.Forms.Button(); this.txtCode = new System.Windows.Forms.TextBox(); - this.lblCodeType = new System.Windows.Forms.Label(); this.btnSynch = new System.Windows.Forms.Button(); this.btnSynchOut = new System.Windows.Forms.Button(); this.btnSaveAktualText = new System.Windows.Forms.Button(); this.btnCompare = new System.Windows.Forms.Button(); + this.btnMoveToLib = new System.Windows.Forms.Button(); + this.txtCodeType = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // btnClose // this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnClose.Location = new System.Drawing.Point(604, 642); - this.btnClose.Margin = new System.Windows.Forms.Padding(2); + this.btnClose.Location = new System.Drawing.Point(805, 790); + this.btnClose.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnClose.Name = "btnClose"; - this.btnClose.Size = new System.Drawing.Size(56, 23); + this.btnClose.Size = new System.Drawing.Size(75, 28); this.btnClose.TabIndex = 0; this.btnClose.Text = "Close"; this.btnClose.UseVisualStyleBackColor = true; @@ -56,33 +57,23 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtCode.Font = new System.Drawing.Font("Courier New", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtCode.Location = new System.Drawing.Point(11, 54); - this.txtCode.Margin = new System.Windows.Forms.Padding(2); + this.txtCode.Location = new System.Drawing.Point(15, 66); + this.txtCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txtCode.Multiline = true; this.txtCode.Name = "txtCode"; this.txtCode.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.txtCode.Size = new System.Drawing.Size(650, 578); + this.txtCode.Size = new System.Drawing.Size(865, 710); this.txtCode.TabIndex = 1; this.txtCode.TextChanged += new System.EventHandler(this.txtCode_TextChanged); this.txtCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCode_KeyDown); // - // lblCodeType - // - this.lblCodeType.AutoSize = true; - this.lblCodeType.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblCodeType.Location = new System.Drawing.Point(9, 28); - this.lblCodeType.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.lblCodeType.Name = "lblCodeType"; - this.lblCodeType.Size = new System.Drawing.Size(75, 16); - this.lblCodeType.TabIndex = 2; - this.lblCodeType.Text = ""; - // // btnSynch // this.btnSynch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnSynch.Location = new System.Drawing.Point(494, 642); + this.btnSynch.Location = new System.Drawing.Point(659, 790); + this.btnSynch.Margin = new System.Windows.Forms.Padding(4); this.btnSynch.Name = "btnSynch"; - this.btnSynch.Size = new System.Drawing.Size(105, 23); + this.btnSynch.Size = new System.Drawing.Size(140, 28); this.btnSynch.TabIndex = 3; this.btnSynch.Text = "Synch Moves To"; this.btnSynch.UseVisualStyleBackColor = true; @@ -92,9 +83,10 @@ // btnSynchOut // this.btnSynchOut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnSynchOut.Location = new System.Drawing.Point(378, 642); + this.btnSynchOut.Location = new System.Drawing.Point(504, 790); + this.btnSynchOut.Margin = new System.Windows.Forms.Padding(4); this.btnSynchOut.Name = "btnSynchOut"; - this.btnSynchOut.Size = new System.Drawing.Size(110, 23); + this.btnSynchOut.Size = new System.Drawing.Size(147, 28); this.btnSynchOut.TabIndex = 4; this.btnSynchOut.Text = "Synch Moves From"; this.btnSynchOut.UseVisualStyleBackColor = true; @@ -104,9 +96,10 @@ // btnSaveAktualText // this.btnSaveAktualText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnSaveAktualText.Location = new System.Drawing.Point(12, 642); + this.btnSaveAktualText.Location = new System.Drawing.Point(16, 790); + this.btnSaveAktualText.Margin = new System.Windows.Forms.Padding(4); this.btnSaveAktualText.Name = "btnSaveAktualText"; - this.btnSaveAktualText.Size = new System.Drawing.Size(83, 23); + this.btnSaveAktualText.Size = new System.Drawing.Size(111, 28); this.btnSaveAktualText.TabIndex = 5; this.btnSaveAktualText.Text = "Spara Copy"; this.btnSaveAktualText.UseVisualStyleBackColor = true; @@ -114,28 +107,52 @@ // // btnCompare // - this.btnCompare.Location = new System.Drawing.Point(101, 642); + this.btnCompare.Location = new System.Drawing.Point(135, 790); + this.btnCompare.Margin = new System.Windows.Forms.Padding(4); this.btnCompare.Name = "btnCompare"; - this.btnCompare.Size = new System.Drawing.Size(98, 23); + this.btnCompare.Size = new System.Drawing.Size(131, 28); this.btnCompare.TabIndex = 6; this.btnCompare.Text = "Compare Existing"; this.btnCompare.UseVisualStyleBackColor = true; this.btnCompare.Click += new System.EventHandler(this.btnCompare_Click); // + // btnMoveToLib + // + this.btnMoveToLib.Enabled = false; + this.btnMoveToLib.Location = new System.Drawing.Point(273, 790); + this.btnMoveToLib.Name = "btnMoveToLib"; + this.btnMoveToLib.Size = new System.Drawing.Size(131, 28); + this.btnMoveToLib.TabIndex = 7; + this.btnMoveToLib.Text = "Flytta Till cpylib"; + this.btnMoveToLib.UseVisualStyleBackColor = true; + this.btnMoveToLib.Click += new System.EventHandler(this.btnMoveToLib_Click); + // + // txtCodeType + // + this.txtCodeType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtCodeType.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtCodeType.Location = new System.Drawing.Point(16, 34); + this.txtCodeType.Name = "txtCodeType"; + this.txtCodeType.ReadOnly = true; + this.txtCodeType.Size = new System.Drawing.Size(864, 15); + this.txtCodeType.TabIndex = 8; + // // ShowCode // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(670, 674); + this.ClientSize = new System.Drawing.Size(893, 830); + this.Controls.Add(this.txtCodeType); + this.Controls.Add(this.btnMoveToLib); this.Controls.Add(this.btnCompare); this.Controls.Add(this.btnSaveAktualText); this.Controls.Add(this.btnSynchOut); this.Controls.Add(this.btnSynch); - this.Controls.Add(this.lblCodeType); this.Controls.Add(this.txtCode); this.Controls.Add(this.btnClose); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "ShowCode"; this.Text = "ShowCode"; this.Load += new System.EventHandler(this.ShowCode_Load); @@ -148,10 +165,11 @@ private System.Windows.Forms.Button btnClose; private System.Windows.Forms.TextBox txtCode; - private System.Windows.Forms.Label lblCodeType; private System.Windows.Forms.Button btnSynch; private System.Windows.Forms.Button btnSynchOut; private System.Windows.Forms.Button btnSaveAktualText; private System.Windows.Forms.Button btnCompare; + private System.Windows.Forms.Button btnMoveToLib; + private System.Windows.Forms.TextBox txtCodeType; } } \ No newline at end of file diff --git a/CobXmlSupport/ShowCode.cs b/CobXmlSupport/ShowCode.cs index f721839..24e4edf 100644 --- a/CobXmlSupport/ShowCode.cs +++ b/CobXmlSupport/ShowCode.cs @@ -24,6 +24,8 @@ namespace CobXmlSupport string oldTxt; bool bSynch; string finalFileSafe; + string wholeFilePath; + string existing = ""; public savedFile SavedFile { get; set; } @@ -32,6 +34,7 @@ namespace CobXmlSupport InitializeComponent(); oldTxt = ""; bSynch = false; + btnMoveToLib.Enabled = false; } public bool BSynch @@ -56,8 +59,12 @@ namespace CobXmlSupport public string Labeltext { - get { return lblCodeType.Text; } - set { lblCodeType.Text = value; } + get { return wholeFilePath; } + set + { + wholeFilePath = value; + txtCodeType.Text = wholeFilePath.Substring(wholeFilePath.LastIndexOf("\\") + 1); ; + } } private GenCobCode parentWindow; @@ -95,9 +102,9 @@ namespace CobXmlSupport private void btnSynch_Click(object sender, EventArgs e) { - codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text,parentWindow.FldPref); + codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text, parentWindow.FldPref); string fieldCompl = ""; - this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileInId + "\r\n codePath = " + Cc.PathId+Cc.CcFileInId + "\r\n -------------- \r\n" + this.CodeShower.Text; + this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileInId + "\r\n codePath = " + Cc.PathId + Cc.CcFileInId + "\r\n -------------- \r\n" + this.CodeShower.Text; Cc.TryFill_In_Dic(); foreach (CobRow cr in parentWindow.RowList) @@ -112,7 +119,7 @@ namespace CobXmlSupport } } if (cr.MoveCode == null) { cr.MoveCode = " "; } - Cc.WorkDicIn[cr.FieldName]=cr.MoveCode; + Cc.WorkDicIn[cr.FieldName] = cr.MoveCode; } } @@ -302,7 +309,7 @@ namespace CobXmlSupport private void btnSynchOut_Click(object sender, EventArgs e) { - codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text,parentWindow.FldPref); + codeCompleter Cc = new codeCompleter(parentWindow.CmbLastFile.Text, parentWindow.FldPref); string fieldCompl = ""; this.CodeShower.Text = " InPath = " + Cc.PathId + "\r\n InFile = " + Cc.FileId + "\r\n codeFile = " + Cc.CcFileOutId + "\r\n codePath = " + Cc.PathId + Cc.CcFileOutId + "\r\n -------------- \r\n" + this.CodeShower.Text; Cc.TryFill_Out_Dic(); @@ -346,29 +353,46 @@ namespace CobXmlSupport if (parentWindow == null) { btnSaveAktualText.Enabled = false; + finalFileSafe = wholeFilePath; + btnCompare.Enabled = true; + } + else + { + btnSaveAktualText.Enabled = true; + btnCompare.Enabled = false; } - else btnSaveAktualText.Enabled = true; - btnCompare.Enabled = false; } private void btnCompare_Click(object sender, EventArgs e) { + existing = ""; try { - string existing = finalFileSafe.Substring(finalFileSafe.LastIndexOf("\\")); - try - { - Process.Start("C:\\Program Files (x86)\\WinMerge\\WinMergeU.exe", finalFileSafe + " Q:\\kII20\\cpy\\" + existing); - } - catch (Exception) - { - Process.Start("C:\\Program Files\\WinMerge\\WinMergeU.exe", finalFileSafe + " Q:\\kII20\\cpy\\" + existing); - } + + existing = finalFileSafe.Substring(finalFileSafe.LastIndexOf("\\") + 1); + Process.Start("C:\\Program Files (x86)\\WinMerge\\WinMergeU.exe", finalFileSafe + " Q:\\kII20\\cpy\\" + existing); } catch (Exception ex) { MessageBox.Show("Problem vid starta WinMerge :" + ex.Message); } + btnMoveToLib.Enabled = true; + } + + private void btnMoveToLib_Click(object sender, EventArgs e) + { + try + { + if (DialogResult.OK == MessageBox.Show("Ok att kopiera :" + finalFileSafe + "\r\ntill Q:\\kII20\\cpy\\" + existing, "Kopiering", MessageBoxButtons.OKCancel)) + { + File.Copy(finalFileSafe, "Q:\\kII20\\cpy\\" + existing,true); + btnMoveToLib.Enabled = false; + } + } + catch (Exception ex) + { + MessageBox.Show("Problem vid filkopiering :" + ex.Message); + } } } diff --git a/CobXmlSupport/codeCompleter.cs b/CobXmlSupport/codeCompleter.cs index 19790f9..20c4698 100644 --- a/CobXmlSupport/codeCompleter.cs +++ b/CobXmlSupport/codeCompleter.cs @@ -24,6 +24,8 @@ namespace CobXmlSupport public codeCompleter() { + __wrkDicIn = null; + __wrkDicOut = null; __FieldPrefix = ""; __filePathId = ""; __fileId = "";