diff --git a/Remontor/.vs/Remontor/FileContentIndex/185f8a93-aeb7-4493-ab9e-2e84fac17a15.vsidx b/Remontor/.vs/Remontor/FileContentIndex/185f8a93-aeb7-4493-ab9e-2e84fac17a15.vsidx new file mode 100644 index 0000000..fdbc1fc Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/185f8a93-aeb7-4493-ab9e-2e84fac17a15.vsidx differ diff --git a/Remontor/.vs/Remontor/FileContentIndex/68972fa7-9f69-4878-a33a-ac0aa9dc85ef.vsidx b/Remontor/.vs/Remontor/FileContentIndex/68972fa7-9f69-4878-a33a-ac0aa9dc85ef.vsidx new file mode 100644 index 0000000..aa4b1e0 Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/68972fa7-9f69-4878-a33a-ac0aa9dc85ef.vsidx differ diff --git a/Remontor/.vs/Remontor/FileContentIndex/805f0b68-b6c2-4cc0-8e15-4e0acd9e1e6e.vsidx b/Remontor/.vs/Remontor/FileContentIndex/805f0b68-b6c2-4cc0-8e15-4e0acd9e1e6e.vsidx new file mode 100644 index 0000000..9f7b41b Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/805f0b68-b6c2-4cc0-8e15-4e0acd9e1e6e.vsidx differ diff --git a/Remontor/.vs/Remontor/FileContentIndex/c4423425-efcb-4e12-bf4f-cb35f6f48571.vsidx b/Remontor/.vs/Remontor/FileContentIndex/c4423425-efcb-4e12-bf4f-cb35f6f48571.vsidx new file mode 100644 index 0000000..c9dc700 Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/c4423425-efcb-4e12-bf4f-cb35f6f48571.vsidx differ diff --git a/Remontor/.vs/Remontor/v17/.suo b/Remontor/.vs/Remontor/v17/.suo index 7d6a9c8..db3660d 100644 Binary files a/Remontor/.vs/Remontor/v17/.suo and b/Remontor/.vs/Remontor/v17/.suo differ diff --git a/Remontor/Connector/Connect.cs b/Remontor/Connector/Connect.cs index c3cf3d3..7c4718b 100644 --- a/Remontor/Connector/Connect.cs +++ b/Remontor/Connector/Connect.cs @@ -63,8 +63,8 @@ namespace Remontor.Connector View.Dock = DockStyle.Fill; panel.Controls.Add(View); ModeMonitor = new OneMon(); - //Proc = Process.Start(@"CmRcViewer.exe", Comp.GetNetNameStr()); - Proc = Process.Start(SGlobalSetting.settingApp.pathApp); + Proc = Process.Start(SGlobalSetting.settingApp.pathApp, Comp.GetNetNameStr()); + //Proc = Process.Start(SGlobalSetting.settingApp.pathApp); //Thread.Sleep(500); // Allow the process to open it's window Proc.WaitForInputIdle(); SetParent(Proc.MainWindowHandle, View.Handle); @@ -72,7 +72,7 @@ namespace Remontor.Connector ModeMonitor.Resize(Proc, View); } catch (Exception) { - MessageBox.Show("Не верно заданно придложение для подключения."); + MessageBox.Show("Не верно заданно приложение для подключения."); ModeMonitor = new OffMon(); SConnector.Panel.Controls.Remove(View); return; diff --git a/Remontor/Finder/Finder.Designer.cs b/Remontor/Finder/Finder.Designer.cs index 783d32b..faea911 100644 --- a/Remontor/Finder/Finder.Designer.cs +++ b/Remontor/Finder/Finder.Designer.cs @@ -100,6 +100,7 @@ this.Controls.Add(this.SeaherPanel); this.Controls.Add(this.CompNameLB); this.Name = "Finder"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Новое подключение"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Finder_FormClosed); this.SeaherPanel.ResumeLayout(false); diff --git a/Remontor/Finder/Finder.cs b/Remontor/Finder/Finder.cs index 255ea45..da9e317 100644 --- a/Remontor/Finder/Finder.cs +++ b/Remontor/Finder/Finder.cs @@ -155,7 +155,7 @@ namespace Remontor.Finder private void Finder_FormClosed(object sender, FormClosedEventArgs e) { - PingManager.StopPing(); + } } } diff --git a/Remontor/History/HistoryControl.cs b/Remontor/History/HistoryControl.cs index 438caf1..e8c87e1 100644 --- a/Remontor/History/HistoryControl.cs +++ b/Remontor/History/HistoryControl.cs @@ -27,7 +27,7 @@ namespace Remontor.History string output = string.Format("{0,17: HH:mm:ss dd.MM.yy}", hitem.GetStart()); TimeLB.Text = output; PCLB.Text = hitem.NameNode(); - FIOLB.Text = hitem.GetComp().GetName(); + FIOLB.Text = hitem.GetComp().GetDescription(); BackCustum = this.BackColor; } diff --git a/Remontor/Picter/PicBase.cs b/Remontor/Picter/PicBase.cs index fcd2b81..6fac713 100644 --- a/Remontor/Picter/PicBase.cs +++ b/Remontor/Picter/PicBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,5 +9,46 @@ namespace Remontor.Picter { internal class PicBase { + private Image Img; + private string Login; + private bool loaded; + public PicBase(Image img) + { + + if(img != null) + { + Img = img; + loaded = true; + } + else + { + loaded = false; + } + + } + + public PicBase(Image img, string login) + { + Login = login; + if (img != null) + { + Img = img; + loaded = true; + } + else + { + loaded = false; + } + } + + public bool Loaded() + { + return loaded; + } + public Image ImageGet + { + get { return Img; } + } + } } diff --git a/Remontor/Picter/PicLoaderTask.cs b/Remontor/Picter/PicLoaderTask.cs index 75790da..2b36819 100644 --- a/Remontor/Picter/PicLoaderTask.cs +++ b/Remontor/Picter/PicLoaderTask.cs @@ -1,12 +1,38 @@ using System; using System.Collections.Generic; +using System.Drawing; +using System.IO; using System.Linq; +using System.Net; +using System.Security.Policy; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace Remontor.Picter { internal class PicLoaderTask { + private string Name; + private WebClient Client; + private Image Img; + private PictureBox ImagePanel; + public PicLoaderTask(string name, PictureBox imagePanel) + { + ImagePanel = imagePanel; + this.Name = name; + Client = new WebClient(); + Client.DownloadDataCompleted += Client_DownloadDataCompleted; + Uri url = new Uri("http://localhost/Photo/titov.png"); + Client.DownloadDataAsync(url); + } + + private void Client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) + { + + Img = new Bitmap(new MemoryStream(e.Result)); + ImagePanel.Image = Img; + // throw new NotImplementedException(); + } } } diff --git a/Remontor/Picter/SPicManager.cs b/Remontor/Picter/SPicManager.cs index b895261..148c5cb 100644 --- a/Remontor/Picter/SPicManager.cs +++ b/Remontor/Picter/SPicManager.cs @@ -1,4 +1,5 @@ -using System; +using Remontor.Words; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,12 +8,34 @@ using System.Windows.Forms; namespace Remontor.Picter { - internal class SPicManager + internal static class SPicManager { - Dictionary PicList = new Dictionary(); - public void PictureSet(PictureBox image, IComp comp) + private static Dictionary PicList = new Dictionary(); + public static void PictureSet(PictureBox image, IComp comp) { + IComp Comp = WordsList.FindCompName(comp.GetNetName()); + if(Comp != null) + { + // image = comp.GetImage(); + return; + } + else + { + comp.SetName("titov"); + if (comp.GetName() != null) + { + + if (PicList.ContainsKey(comp.GetName())) + { + image.Image = PicList[comp.GetName()].ImageGet; + } + else + { + new PicLoaderTask(comp.GetName(), image); + } + } + } } } } diff --git a/Remontor/Pinger/PingManager.cs b/Remontor/Pinger/PingManager.cs index 56655a0..722af3a 100644 --- a/Remontor/Pinger/PingManager.cs +++ b/Remontor/Pinger/PingManager.cs @@ -14,7 +14,7 @@ namespace Remontor.Pinger static Dictionary ResultPing = new Dictionary(); static List TaskList = new List(); static int LifeTimePing = 20; - static Thread PingerHost = new Thread(PingHost); + static public void NewTaskPing(Panel panel, IComp comp) { @@ -48,7 +48,7 @@ namespace Remontor.Pinger //panel.Visible = true; // panel.BackColor = Color.Gold; PingTask pingTask = new PingTask(panel, comp); - TaskList.Add(pingTask); + //if(PingerHost.ThreadState == ThreadState.Unstarted) //{ // PingerHost.Start(); @@ -63,33 +63,8 @@ namespace Remontor.Pinger } - static public void PingHost() - { - // while () - // { - Thread.Sleep(300); - PingTask[] TaskListBuff = new PingTask[TaskList.Count]; - TaskList.CopyTo(TaskListBuff); - TaskList.Clear(); - System.Console.WriteLine(TaskListBuff.Length.ToString()); - foreach (PingTask Task in TaskListBuff) - { - // Task.PingHost(); - } - if (TaskList.Count > 0) PingHost(); - else - { - } - // } - - } - - static public void StopPing() - { - // PingerHost.Join(); - - } + static public void WriteResult(PingResult pingResult) { diff --git a/Remontor/Pinger/PingTask.cs b/Remontor/Pinger/PingTask.cs index 10833f3..5602a92 100644 --- a/Remontor/Pinger/PingTask.cs +++ b/Remontor/Pinger/PingTask.cs @@ -19,6 +19,24 @@ namespace Remontor.Pinger private Panel panel; private Ping pinger; + + public PingTask( IComp comp) + { + this.Comp = comp; + this.NameOrAddress = comp.GetNetName(); + pinger = new Ping(); + pinger.PingCompleted += Pinger_PingCompleted; + try + { + pinger.SendPingAsync(NameOrAddress, 3); + } + catch + { + pinger.SendAsyncCancel(); + if (panel != null) panel.BackColor = Color.OrangeRed; + } + + } public PingTask(Panel panel, IComp comp) { this.panel = panel; diff --git a/Remontor/Seacher/SCCMResult.cs b/Remontor/Seacher/SCCMResult.cs index 67ef570..ca39f71 100644 --- a/Remontor/Seacher/SCCMResult.cs +++ b/Remontor/Seacher/SCCMResult.cs @@ -9,13 +9,13 @@ namespace Remontor.Seacher internal class SCCMResult : ISeacherResult { private IComp Comp; - private DateTime LastConnect; + private string LastConnect; private string StrQuestion; public SCCMResult() { } - public SCCMResult(IComp comp, DateTime lastConnect) + public SCCMResult(IComp comp, string lastConnect) { Comp = comp; LastConnect = lastConnect; @@ -24,7 +24,7 @@ namespace Remontor.Seacher public SCCMResult(IComp comp, string lastConnect, string strQuestion) { Comp = comp; - LastConnect = DateTime.Parse(lastConnect); + LastConnect = lastConnect; StrQuestion = strQuestion; } @@ -33,7 +33,7 @@ namespace Remontor.Seacher return Comp; } - public DateTime GetLastConnect() + public string GetLastConnect() { return LastConnect; } diff --git a/Remontor/Seacher/SeachSCCM.cs b/Remontor/Seacher/SeachSCCM.cs index 1c205ea..f7bec3e 100644 --- a/Remontor/Seacher/SeachSCCM.cs +++ b/Remontor/Seacher/SeachSCCM.cs @@ -13,6 +13,7 @@ using System.Xml.Linq; using static Remontor.Seacher.SeahcLocal; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; using System.Threading; +using System.Windows.Forms; namespace Remontor.Seacher { @@ -25,7 +26,7 @@ namespace Remontor.Seacher private bool enable; private string error; private Mode mode; - private Timer TimerDisconnect; + private System.Threading.Timer TimerDisconnect; private enum Mode{ PCname, @@ -137,10 +138,10 @@ namespace Remontor.Seacher } else { - result = "SELECT TOP (15) dbo._RES_COLL_SMS00001.Name, dbo._RES_COLL_SMS00001.UserName, dbo.v_R_User.Full_User_Name0, dbo._RES_COLL_SMS00001.LastActiveTime FROM dbo._RES_COLL_SMS00001 LEFT JOIN dbo.v_R_User ON dbo._RES_COLL_SMS00001.UserName = dbo.v_R_User.User_Name0 WHERE LOWER(dbo._RES_COLL_SMS00001.Name) LIKE LOWER(N'%" + query + "%') OR LOWER(dbo._RES_COLL_SMS00001.UserName) LIKE LOWER(N'%" + query + "%')" + - ""; ; + result = "SELECT TOP (15) dbo._RES_COLL_SMS00001.Name, dbo._RES_COLL_SMS00001.UserName, dbo.v_R_User.Full_User_Name0, dbo._RES_COLL_SMS00001.LastActiveTime FROM dbo._RES_COLL_SMS00001 LEFT JOIN dbo.v_R_User ON dbo._RES_COLL_SMS00001.UserName = dbo.v_R_User.User_Name0 WHERE LOWER(dbo._RES_COLL_SMS00001.Name) LIKE LOWER(N'%" + query + "%') OR LOWER(dbo._RES_COLL_SMS00001.UserName) LIKE LOWER(N'%" + query + "%')"; mode = Mode.Login; } + //MessageBox.Show(mode.ToString()); return result; } //public List ResultSeach(string seach) @@ -231,18 +232,26 @@ namespace Remontor.Seacher quest = comp.GetNetNameStr(); break; } - SCCMResult itemResult = new SCCMResult(comp, myData[i].ItemArray[3].ToString(), quest); + string buffStr ="NOT"; + if (myData[i].ItemArray[3] is DateTime) + { + buffStr = myData[i].ItemArray[3].ToString(); + } + else + { + buffStr = "Нет данных"; + } + SCCMResult itemResult = new SCCMResult(comp, buffStr, quest); result.Add(itemResult); ++y; } - enable = true; + } catch { y = 1; - enable = false; - result.Clear(); - result.Add(new NoResult("Ничего не найдено")); + //result.Clear(); + result.Add(new NoResult("Ошибка обработки")); } } @@ -267,7 +276,7 @@ namespace Remontor.Seacher Console.WriteLine("Подключились"); error = "Подключенно"; TimerCallback TimerDelegate = new TimerCallback(Deactivate); - TimerDisconnect = new Timer(TimerDelegate, null, 90000,90000); + TimerDisconnect = new System.Threading.Timer(TimerDelegate, null, 90000,90000); } catch { @@ -283,9 +292,9 @@ namespace Remontor.Seacher Connection.Close(); Connection = null; TimerDisconnect.Dispose(); - List result = new List(); - result.Add(new NoResult("Введите запрос")); - Update(result); + // List result = new List(); + // result.Add(new NoResult("Введите запрос")); + // Update(result); } //public IComp Result(int index) diff --git a/Remontor/SessionItemControl.cs b/Remontor/SessionItemControl.cs index d7dea50..5506830 100644 --- a/Remontor/SessionItemControl.cs +++ b/Remontor/SessionItemControl.cs @@ -1,4 +1,5 @@ -using Remontor.Pinger; +using Remontor.Picter; +using Remontor.Pinger; using Remontor.Seacher; using System; using System.Collections.Generic; @@ -56,6 +57,8 @@ namespace Remontor LbData.Text = "last connect:" + result.GetLastConnect(); Select += UpdateAct; Index = index; + + SPicManager.PictureSet(PbPerson, result.GetComp()); } diff --git a/Remontor/Words/IWordsItem.cs b/Remontor/Words/IWordsItem.cs index d1d780f..615aaec 100644 --- a/Remontor/Words/IWordsItem.cs +++ b/Remontor/Words/IWordsItem.cs @@ -14,6 +14,7 @@ namespace Remontor.Words public abstract List CategoryList(); + public abstract IComp FindCompName(string compName); public abstract void Delete(); public abstract TreeNode NodeList(); public abstract bool ChekMove(IWordsItem wordsItem); diff --git a/Remontor/Words/WordsCategory.cs b/Remontor/Words/WordsCategory.cs index edc1045..45f927c 100644 --- a/Remontor/Words/WordsCategory.cs +++ b/Remontor/Words/WordsCategory.cs @@ -104,6 +104,16 @@ namespace Remontor.Words } + public override IComp FindCompName(string compName) + { + foreach (var item in items) + { + IComp comp = item.FindCompName(compName); + if (comp != null) return comp; + } + return null; + } + public override TreeNode NodeList() { TreeNode treeNode = new TreeNode(GetName()); diff --git a/Remontor/Words/WordsComp.cs b/Remontor/Words/WordsComp.cs index 9eefb95..8ab84f6 100644 --- a/Remontor/Words/WordsComp.cs +++ b/Remontor/Words/WordsComp.cs @@ -92,6 +92,14 @@ namespace Remontor.Words { return new List(); } + public override IComp FindCompName(string compName) + { + if(compName.ToUpper() == Comp.GetNetName().ToUpper()) + { + return Comp; + } + return null; + } public string NameNode() { diff --git a/Remontor/Words/WordsList.cs b/Remontor/Words/WordsList.cs index 1810b88..631c0b2 100644 --- a/Remontor/Words/WordsList.cs +++ b/Remontor/Words/WordsList.cs @@ -25,7 +25,10 @@ namespace Remontor.Words { SrcCategory.Move(index, item, DstCategory); } - + public static IComp FindCompName(string compName) + { + return MainCategory.FindCompName(compName); + } public static TreeNode[] ListNodes() { TreeNode[] treeNodes = new TreeNode[MainCategory.Count()]; diff --git a/Remontor/bin/Debug/Remontor.exe b/Remontor/bin/Debug/Remontor.exe index 44c6c4d..7a0a6e4 100644 Binary files a/Remontor/bin/Debug/Remontor.exe and b/Remontor/bin/Debug/Remontor.exe differ diff --git a/Remontor/bin/Debug/Remontor.pdb b/Remontor/bin/Debug/Remontor.pdb index 7b1d93a..e16bd4f 100644 Binary files a/Remontor/bin/Debug/Remontor.pdb and b/Remontor/bin/Debug/Remontor.pdb differ diff --git a/Remontor/bin/Debug/res.dat b/Remontor/bin/Debug/res.dat index 54035ba..0aaccaf 100644 Binary files a/Remontor/bin/Debug/res.dat and b/Remontor/bin/Debug/res.dat differ diff --git a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache index d5f051a..7a623c9 100644 Binary files a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 3a482ed..2d3f4ec 100644 Binary files a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Remontor/obj/Debug/Remontor.csproj.CoreCompileInputs.cache b/Remontor/obj/Debug/Remontor.csproj.CoreCompileInputs.cache index e6b7d98..badcfbe 100644 --- a/Remontor/obj/Debug/Remontor.csproj.CoreCompileInputs.cache +++ b/Remontor/obj/Debug/Remontor.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -09d76672eda20daf058c432a32f616590893aaa4 +9a443a3f00d6902d59ef00044ff4ad2031b21723 diff --git a/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache b/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache index 8ae0d67..0624dab 100644 Binary files a/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache and b/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache differ diff --git a/Remontor/obj/Debug/Remontor.exe b/Remontor/obj/Debug/Remontor.exe index 44c6c4d..7a0a6e4 100644 Binary files a/Remontor/obj/Debug/Remontor.exe and b/Remontor/obj/Debug/Remontor.exe differ diff --git a/Remontor/obj/Debug/Remontor.pdb b/Remontor/obj/Debug/Remontor.pdb index 7b1d93a..e16bd4f 100644 Binary files a/Remontor/obj/Debug/Remontor.pdb and b/Remontor/obj/Debug/Remontor.pdb differ