Ejemplo n.º 1
0
        void endConfApply(object sender, ConfApplyCompletedEventArgs e)
        {
            Debug.WriteLine("ConfApplyCompleted");
            string result = "";

            if (!e.isError)
            {
                sbLog.AppendLine(System.DateTime.Today.ToString() + " - " + Msg.DEF_SETCONFCOMPLETE);
                result = Msg.DEF_SETCOMPLETE + "\n" + Msg.DEF_RESTART;
            }
            else
            {
                if (e.errorMsg.Trim().Equals(""))
                {
                    result = MsgERR.ERR_RUN + "\n" + Msg.DEF_RESTART;
                }
                else
                {
                    result = MsgERR.ERR_FOLLOW + " : \n" + e.errorMsg;
                }
                SetLbStatusText(MsgForm.PROBLEM);
                picStatus.Image = Properties.Resources.ERROR;
            }
            setLbInfoText(MsgForm.COMPLETE);
            MessageBox.Show(result);
            SetbtnFuncClickEvent(btnFunc_Click, false);
            SetbtnFuncClickEvent(btnFunc_Click_Cancel, false);
            SetbtnFuncEnabled(true);
            SetbtnFuncText(MsgForm.CLOSE);
            SetbtnFuncClickEvent(btnFunc_Click_Exit, true);
            setLbLogText(MsgForm.LOG);
        }
Ejemplo n.º 2
0
 protected virtual void OnConfApplyCompleted(ConfApplyCompletedEventArgs e)
 {
     if (ConfApplyCompletedEvent != null)
     {
         ConfApplyCompletedEvent(this, e);
     }
 }
Ejemplo n.º 3
0
        private void PatchXMLData(JObject xmlJson)
        {
            //WorkCompletedEventArgs wCe = new WorkCompletedEventArgs(false, "");
            //OnWorkCompleted(wCe);


            Boolean isUpdateProcessed          = false;
            Dictionary <string, string> dicXml = JsonConvert.DeserializeObject <Dictionary <string, string> >(xmlJson.ToString());

            foreach (KeyValuePair <string, string> value in dicXml)
            {
                XmlDocument xdClient = new XmlDocument();
                XmlDocument xdServer = new XmlDocument();
                try
                {
                    Boolean isUpdate = false;
                    Debug.WriteLine("Load : " + strDestPath + value.Key);
                    xdClient.Load(strDestPath + value.Key);
                    Debug.WriteLine("Load Complete");
                    Debug.WriteLine("Server XML : " + value.Value);
                    String xml = value.Value;
                    //String xml = HttpUtility.UrlDecode(value.Value, Encoding.UTF8);
                    xdServer.LoadXml(xml.TrimStart());

                    isUpdate = syncDiffData(xdClient.DocumentElement, xdServer.DocumentElement, ref xdClient, ref xdServer);
                    if (isUpdate)
                    {
                        ConfApplyEventArgs cAe = new ConfApplyEventArgs(false, strDestPath + value.Key);
                        OnConfApply(cAe);
                        isUpdateProcessed = true;
                    }
                    Debug.WriteLine("Save : " + strDestPath + value.Key);
                    xdClient.Save(strDestPath + value.Key);
                    Debug.WriteLine("Save Complete");
                }
                catch (Exception e)
                {
                    Debug.WriteLine("An error has occured : " + e.ToString());
                    continue;
                }
            }
            if (isUpdateProcessed)
            {
                ConfApplyCompletedEventArgs cCe = new ConfApplyCompletedEventArgs(false, "");
                OnConfApplyCompleted(cCe);
            }
            else
            {
                WorkCompletedEventArgs wCe = new WorkCompletedEventArgs(false, "");
                OnWorkCompleted(wCe);
            }
        }