private void XmlRead()
        {
            WindowsXml useruixml = new WindowsXml();

            if (useruixml.WindowsLoadXml() == null)
            {
                AddUserInfo();
            }
            else
            {
                string[] useroderlist = (string[])useruixml.WindowsLoadXml();

                if (useroderlist.Length == filelist.Count + directorylist.Count)
                {
                    CreateUserICon();

                    for (int i = 0; i < useroderlist.Length; i++)
                    {
                        for (int j = 0; j < userdocument.Count; j++)
                        {
                            UserFolder folderInfo = (UserFolder)userdocument[j];

                            if (string.Compare(useroderlist[i], folderInfo.IconName) == 0)
                            {
                                SetAddPanel();

                                wallpaperline1.Children.Add((UserFolder)userdocument[j]);
                                break;
                            }
                        }

                        for (int k = 0; k < userfile.Count; k++)
                        {
                            UserFile fileInfo = (UserFile)userfile[k];

                            if (string.Compare(useroderlist[i], fileInfo.IconName) == 0)
                            {
                                SetAddPanel();

                                wallpaperline1.Children.Add((UserFile)userfile[k]);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    wallpaperline1.Children.Clear();

                    AddUserInfo();
                }
            }
        }
        private void ResetUserInfo()
        {
            LoadWindows();
            CreateUserICon();

            WindowsXml useruixml = new WindowsXml();

            string[] useroderlist = (string[])useruixml.WindowsLoadXml();

            if (useroderlist.Length < userdocument.Count + userfile.Count)
            {
                for (int i = 0; i < useroderlist.Length; i++)
                {
                    for (int j = 0; j < userdocument.Count; j++)
                    {
                        UserFolder folderInfo = (UserFolder)userdocument[j];

                        if (string.Compare(useroderlist[i], folderInfo.IconName) == 0)
                        {
                            SetAddPanel();

                            wallpaperline1.Children.Add((UserFolder)userdocument[j]);

                            userdocument.RemoveAt(j);
                            break;
                        }
                    }

                    for (int k = 0; k < userfile.Count; k++)
                    {
                        UserFile fileInfo = (UserFile)userfile[k];

                        if (string.Compare(useroderlist[i], fileInfo.IconName) == 0)
                        {
                            SetAddPanel();

                            wallpaperline1.Children.Add((UserFile)userfile[k]);

                            userfile.RemoveAt(k);
                            break;
                        }
                    }
                }

                if (userdocument.Count != 0)
                {
                    wallpaperline1.Children.Add((UserFolder)userdocument[0]);
                    XmlWrite();
                }
                else if (userfile.Count != 0)
                {
                    wallpaperline1.Children.Add((UserFile)userfile[0]);
                    XmlWrite();
                }
            }
            else if (useroderlist.Length > userdocument.Count + userfile.Count)
            {
                for (int i = 0; i < useroderlist.Length; i++)
                {
                    for (int j = 0; j < userdocument.Count; j++)
                    {
                        UserFolder folderInfo = (UserFolder)userdocument[j];

                        if (string.Compare(useroderlist[i], folderInfo.IconName) == 0)
                        {
                            SetAddPanel();

                            wallpaperline1.Children.Add((UserFolder)userdocument[j]);

                            userdocument.RemoveAt(j);
                            break;
                        }
                    }

                    for (int k = 0; k < userfile.Count; k++)
                    {
                        UserFile fileInfo = (UserFile)userfile[k];

                        if (string.Compare(useroderlist[i], fileInfo.IconName) == 0)
                        {
                            SetAddPanel();

                            wallpaperline1.Children.Add((UserFile)userfile[k]);

                            userfile.RemoveAt(k);
                            break;
                        }
                    }
                }
            }
        }
        private void XmlWrite()
        {
            writexml = new ArrayList();

            foreach (UIElement u in wallpaperline1.FluidElements)
            {
                if (u is UserFile)
                    writexml.Add(((UserFile)u).IconName);
                else if (u is UserFolder)
                    writexml.Add(((UserFolder)u).IconName);
            }

            WindowsXml useruixml = new WindowsXml();
            useruixml.WindowsWriteXml(writexml);

            writexml.Clear();
        }
        private void UserWindows_Loaded(object sender, RoutedEventArgs e)
        {
            SetOnDesktop(this);

            this.Left = 0;
            this.Top = 0;
            this.WindowState = WindowState.Maximized;

            WindowsXml windowxml = new WindowsXml();


            if(windowxml.WallpaperLoad() != null)
            Img1.Source = new BitmapImage(new Uri(windowxml.WallpaperLoad(), UriKind.Absolute));
        }
        public void NoUSB_AutoDownLoad()
        {
            string[] array = new string[3];
            string Receive_CompactFile;

            if (NoUSBlist.Count != 0)
            {
                for (int i = 0; i < NoUSBlist.Count; i++)
                {
                    Receive_CompactFile = NoUSBlist[i].ToString();
                    array = Receive_CompactFile.Split('\a');

                    if (id == array[0])
                    {
                        char[] delimiterChars = { '\\' };
                        string[] words = array[1].Split(delimiterChars);
                        Server_File = words[words.Length - 1];

                        multiFileName[i] = Server_File;
                    }
                }

                if (id == array[0])
                {
                    if (System.IO.File.Exists(usbpath + USB_Path + id + " - " + Server_File))        //USB_Path = "SchoolInteligentUSB\\FileRoom\\"
                        return;

                    else
                    {
                        string UpdateFile = id + " - " + Server_File;

                        System.Windows.Forms.DialogResult dr = System.Windows.Forms.MessageBox.Show("서버에 업데이트된 파일이 있습니다. 받으시겠습니까?", "알림", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Information);

                        if (dr == System.Windows.Forms.DialogResult.OK)
                        {
                            DownloadFile(multiFileName);

                            WindowsXml useruixml = new WindowsXml();
                            useruixml.NoUsbDownLoadXML_Write(UpdateFile);

                            Process.Start(usbpath + "SchoolInteligentUSB\\FileRoom");

                            MessageBox.Show("다운로드가 완료되었습니다.");
                        }
                    }
                }
            }
            else
                return;
        }
        private void WallPaper_One_Change(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            WindowsXml windowxml = new WindowsXml();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                if (ImageList.Count > 1)
                {
                    ImageList.Clear();
                    Img1.Source = new BitmapImage(new Uri(dialog.FileName, UriKind.Absolute));
                    
                    windowxml.WallpaperWrite(dialog.FileName);
                }
                else
                {
                    Img1.Source = new BitmapImage(new Uri(dialog.FileName, UriKind.Absolute));

                    windowxml.WallpaperWrite(dialog.FileName);
                }

            }
        }
        public WindowsStyle(Service s, string info)
        {
            InitializeComponent();

            service = s;
            service.Ws = this;
            SetUser(info);

            usbpath = (string)Application.Current.Properties["USBDrivePath"];

            System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation(1, new Duration(TimeSpan.FromSeconds(1)));
            WallPaper1.BeginAnimation(Grid.OpacityProperty, da);

            ImageList = new System.Collections.Generic.List<BitmapImage>(); //배경화면 리스트 저장

            LoadWindows(); //load the windows

            XmlRead();

            HideOrShow();

            SetUSerLinkList();

            DownloadedFileCheck();

            try
            {
                WindowsXml useruixml = new WindowsXml();

                NoUSBlist = new ArrayList();
                NoUSBlist = service.NoUSBRead();
                multiFileName = new string[NoUSBlist.Count];

                if (NoUSBlist.Count != useruixml.NoUsbDownLoadXML_Read().Count)
                {
                    NoUSB_AutoDownLoad();
                }
            }
            catch
            {
            }

            thread = new Thread(new ThreadStart(UserIconTheading));
            thread.Start();

            foreach (string serial in (string[])Application.Current.Properties["Members"])
            {
                if ((string)Application.Current.Properties["User"] == serial)
                {
                    Application.Current.Properties.Remove("User");
                    continue;
                }

                string name = service.MyName(serial);
                MenuItem item = new MenuItem();
                item.Click += item_Click;
                item.Header = name;
                item.Name = "s_" + serial;
                ((MenuItem)WallPaper1.ContextMenu.Items[8]).Items.Add(item);
            }
            Application.Current.Properties.Remove("Members");

            ewh = new EventWaitHandle(false, EventResetMode.AutoReset);

            th = new Thread(new ThreadStart(DownloadThread));
            th.Start();

            //===================================================
            bw.WorkerSupportsCancellation = true;
            bw.WorkerReportsProgress = true;
            bw.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
            bw.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
        }