Ejemplo n.º 1
0
        public void Download()
        {
            BellComunication BellComObj = BellComunication.ObjCommunication;
            string           content    = BellComObj.DownloadString();

            if (!BellConstants.IsSuccess)
            {
                if (string.IsNullOrEmpty(BellConstants.ErrorMessage))
                {
                    MessageBox.Show("Information is not downloaded due some unknown reason, please try again.");
                }
                else
                {
                    MessageBox.Show(BellConstants.ErrorMessage);
                }
                return;
            }



            string[] splitSeparator = { Environment.NewLine };
            BellContent.ObjContent.Content = content.Split(splitSeparator, StringSplitOptions.RemoveEmptyEntries);
            rtbContent.Lines = BellContent.ObjContent.Content;
            BellContent.ObjContent.IsChanged = false;
            BellComObj.SaveSettings();
            rtbContent.Visible = true;
        }
Ejemplo n.º 2
0
        public void DownloadFile(string AfileName)
        {
            BellComunication BellComObj = new BellComunication();

            BellContent.ObjContent.Content  = GetStringLinesFromContent(BellComObj.DownloadString());
            BellContent.ObjContent.FilePath = AfileName;
            BellContent.ObjContent.SaveContent();
        }
Ejemplo n.º 3
0
        private void btnDownloadBellList_Click(object sender, EventArgs e)
        {
            if ((ScheduleDataManager.IsDirty) &&
                (MessageBox.Show("Do you want to save the existing content?", "Want to Save", MessageBoxButtons.YesNo) == DialogResult.Yes))
            {
                ScheduleDataManager.SaveDataToCSV();
            }

            BellComunication BellComObj = BellComunication.ObjCommunication;
            string           content    = BellComObj.DownloadString();

            if (!BellConstants.IsSuccess)
            {
                if (string.IsNullOrEmpty(BellConstants.ErrorMessage))
                {
                    MessageBox.Show("Information is not downloaded due some unknown reason, please try again.");
                }
                else
                {
                    MessageBox.Show(BellConstants.ErrorMessage);
                }
                return;
            }

            string[] splitSeparator = { Environment.NewLine };
            string[] Content        = content.Split(splitSeparator, StringSplitOptions.RemoveEmptyEntries);
            {
                ScheduleDataManager.LoadData(Content);
                List <ScheduleData> dataUI = new List <ScheduleData>();
                dataUI = ScheduleDataManager.BellDataUI;
                pnlScheduleContainer.Controls.Clear();
                for (int i = 0; i < dataUI.Count; i++)
                {
                    ScheduleData      TempDataUi = dataUI[i];
                    ScheduleDataModel SDM        = new ScheduleDataModel();
                    SDM = TempDataUi.scheduleDM;
                    SDM.SerialNumber      = i + 1;
                    TempDataUi.scheduleDM = SDM;
                    TempDataUi.Location   = new Point(0, (i * 38));
                    TempDataUi.Controls["btnDelete"].Click += DeleteScheduleFromList;
                    TempDataUi.MakeDirty += ScheduleDataManager.ActionMakeDirty;
                    pnlScheduleContainer.Controls.Add(TempDataUi);
                }
            }
        }
Ejemplo n.º 4
0
        public void UploadFile(string AfileName)
        {
            List <string> bells = new List <string>();

            if (File.Exists(AfileName))
            {
                foreach (string line in File.ReadLines(AfileName, Encoding.UTF8))
                {
                    // process the line
                    if (line != @"#Start")
                    {
                        bells.Add(line);
                    }
                }
            }
            if (bells.Count > 0)
            {
                BellComunication BellComObj = new BellComunication();
                BellComObj.UploadBells(bells);
                //Add the bells to the device
            }
        }