Exemple #1
0
        //
        // //

        protected void DoAck(TreeLbItem ti)
        {
            if (MessageBoxResult.OK != MessageBox.Show("Do you really want to acknowledge message?\n\n(press Back to Cancel)"))
            {
                return;
            }

            if (m_sUserIDlast.Length == 0)
            {
                return;
            }

            string sPath = AppLogic.csSecretsFolder + "\\" + m_sUserIDlast;

            RscStore store = new RscStore();

            sPath += "\\Threads";
            if (!store.FolderExists(sPath))
            {
                return;
            }

            MyThread2 th = new MyThread2();

            th = store.ReadXmlDataFile(sPath + "\\" + ti.sID + "\\" + ti.sHistoryID + ".xml", th);
            if (th.ID.Length == 0)
            {
                return;                 //FAIL!!!
            }
            th.DateAcked = DateTime.Now;

            store.WriteXmlDataFile(sPath + "\\" + ti.sID + "\\" + ti.sHistoryID + ".xml", th, true);

            ti.BtnCustom1Visibility = Rsc.Collapsed;
            ti.DetailsOfTitle       = TreeLbItemThread.DecorateSnippet(th);
            ti.ClearCustomBackColor();

            int iCount_NonAckAll = 0;

            iCount_NonAckAll = store.ReadXmlDataFile(sPath + "\\" + "Count_NonAck" + ".xml", iCount_NonAckAll);
            iCount_NonAckAll = Math.Max(0, iCount_NonAckAll - 1);
            store.WriteXmlDataFile(sPath + "\\" + "Count_NonAck" + ".xml", iCount_NonAckAll, true);

            int iCountAll = 0;

            iCountAll = store.ReadXmlDataFile(sPath + "\\" + "Count" + ".xml", iCountAll);
            UpdateSumItem(iCount_NonAckAll, iCountAll);

            m_AppFrame.StatusText = "";             //To refresh mem info...
        }
 public static void SaveAuthResult(RscGoogleAuthResult auth)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         RscStore store = new RscStore();
         store.CreateFolderPath(AppLogic.csSecretsFolder);
         store.WriteXmlDataFile(AppLogic.csSecretsFolder + "\\" + "AUTH.xml", auth, true);
     });
 }
Exemple #3
0
        private void SaveAuthResult(RscGoogleAuthResult auth)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                //ATT: Logged ON!!!
                m_btnLogOut.Visibility = Rsc.Visible;

                RscStore store = new RscStore();
                store.CreateFolderPath(csSecretsFolder);
                store.WriteXmlDataFile(csSecretsFolder + "\\" + "AUTH.xml", auth, true);
            });
        }
        public static int SaveThreadData(bool bCalledByAgent, string sPath, RscJSonItem jsonThreads)
        {
            RscJSonItem json = jsonThreads.GetChildByName("threads");

            if (json == null)
            {
                return(-200);
            }

            RscStore store = new RscStore();

            bool bFirstRun = false;

            sPath += "\\Threads";
            if (!store.FolderExists(sPath))
            {
                bFirstRun = true;

                store.CreateFolderPath(sPath);
                store.WriteTextFile(sPath + "\\" + "Version.txt", ciCurrentVersion.ToString(), true);
            }

            string sThreadIdOrder_OLD = "";

            sThreadIdOrder_OLD  = store.ReadTextFile(sPath + "\\" + "IdOrder" + ".txt", sThreadIdOrder_OLD);
            sThreadIdOrder_OLD += "|";             //ATTENTION!!! 1 of 2
            string sThreadIdOrder_NEW = "";

            int iJustAdded = 0;

            int iThCnt = json.ChildCount;

            for (int iTh = 0; iTh < iThCnt; iTh++)
            {
                RscJSonItem jsonTh = json.GetChild(iTh);

                string sID        = jsonTh.GetPropertyValue("id");
                string sHistoryID = jsonTh.GetPropertyValue("historyId");
                string sSnippet   = jsonTh.GetPropertyValue("snippet");                 //, true );

                if (sID.Length == 0 || sHistoryID.Length == 0 || sSnippet.Length == 0)
                {
                    continue;
                }

                store.CreateFolderPath(sPath + "\\" + sID);

                if (store.FileExists(sPath + "\\" + sID + "\\" + sHistoryID + ".xml"))
                {
                    //Threads arrives in reverse order, so...
                    break;
                }
                else
                {
                    sThreadIdOrder_OLD = sThreadIdOrder_OLD.Replace(sID + "|", "");                       //Removing ID
                    if (sThreadIdOrder_NEW.Length > 0)
                    {
                        sThreadIdOrder_NEW += "|";
                    }
                    sThreadIdOrder_NEW += sID;                     //Adding ID

                    string sIdOrder = "";
                    sIdOrder = store.ReadTextFile(sPath + "\\" + sID + "\\" + "IdOrder" + ".txt", "");

                    iJustAdded++;

                    MyThread2 th = new MyThread2();
                    th.ID        = sID;
                    th.HistoryID = sHistoryID;
                    th.Snippet   = sSnippet;

                    if (bFirstRun)
                    {
                        th.DateAcked = DateTime.Now;
                    }

                    store.WriteXmlDataFile(sPath + "\\" + sID + "\\" + sHistoryID + ".xml", th, true);

                    if (sIdOrder.Length > 0)
                    {
                        sIdOrder = "|" + sIdOrder;
                    }
                    sIdOrder = sHistoryID + sIdOrder;
                    store.WriteTextFile(sPath + "\\" + sID + "\\" + "IdOrder" + ".txt", sIdOrder, true);
                }
            }

            if (sThreadIdOrder_OLD.Length > 0)
            {
                //ATTENTION!!! 2 of 2
                sThreadIdOrder_OLD = sThreadIdOrder_OLD.Substring(0, sThreadIdOrder_OLD.Length - 1);
            }
            if (sThreadIdOrder_NEW.Length > 0 && sThreadIdOrder_OLD.Length > 0)
            {
                sThreadIdOrder_NEW += "|";
            }
            sThreadIdOrder_NEW += sThreadIdOrder_OLD;
            store.WriteTextFile(sPath + "\\" + "IdOrder" + ".txt", sThreadIdOrder_NEW, true);

            int iCountAll = 0;

            iCountAll  = store.ReadXmlDataFile(sPath + "\\" + "Count" + ".xml", iCountAll);
            iCountAll += iJustAdded;
            store.WriteXmlDataFile(sPath + "\\" + "Count" + ".xml", iCountAll, true);

            int iCount_NonAckAll = 0;

            iCount_NonAckAll = store.ReadXmlDataFile(sPath + "\\" + "Count_NonAck" + ".xml", iCount_NonAckAll);
            if (!bFirstRun)
            {
                iCount_NonAckAll += iJustAdded;
            }
            store.WriteXmlDataFile(sPath + "\\" + "Count_NonAck" + ".xml", iCount_NonAckAll, true);

            int iCount_NEW = 0;

            iCount_NEW = store.ReadXmlDataFile(sPath + "\\" + "Count_NEW" + ".xml", iCount_NEW);
            if (bCalledByAgent)
            {
                iCount_NEW += iJustAdded;
            }
            else if (bFirstRun)
            {
                iCount_NEW = 0;
            }
            else
            {
                iCount_NEW = 0;
            }
            store.WriteXmlDataFile(sPath + "\\" + "Count_NEW" + ".xml", iCount_NEW, true);

            return(iJustAdded);
        }