Example #1
0
        private void xmlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var saveFile = new SaveFileDialog()
            {
                DefaultExt = "*.xml",
                Filter     = @"XML Files(*.xml)|*.xml|All files(*.*)|*.*"
            };

            if (saveFile.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            XmlFileHelper.XmlFavouriteWriter(saveFile.FileName, CurrentUserId);

            MessageBox.Show(@"XML file was saved successfully", @"Save",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #2
0
        private void zipToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var saveFile = new SaveFileDialog()
            {
                DefaultExt = "*.zip",
                Filter     = @"ZIP Files(*.zip)|*.zip"
            };

            if (saveFile.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            XmlFileHelper.XmlFavouriteWriter(saveFile.FileName.Split('.')[0] + ".xml", CurrentUserId);
            ZipHelper.CreateZipFile(saveFile.FileName, saveFile.FileName.Split('.')[0] + ".xml");
            Helper.DeleteFileIfExist(saveFile.FileName.Split('.')[0] + ".xml");

            MessageBox.Show(@"ZIP file was saved successfully", @"Save",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #3
0
        private void openXmlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var openXmlFile = new OpenFileDialog
            {
                DefaultExt = "*.xml",
                Filter     = @"XML Files|*.xml"
            };

            if (openXmlFile.ShowDialog() != DialogResult.OK || openXmlFile.FileName.Length <= 0)
            {
                return;
            }

            XmlFileHelper.ParseChannel(openXmlFile.FileName);
            XmlFileHelper.ParseProgramm(openXmlFile.FileName);

            var userType = new BaseRepository <User>().Get(u => u.Id == CurrentUserId).FirstOrDefault()?.UserType.Id;

            if (userType == (int)EUserType.CLIENT)
            {
                _userWindow.SetReloadChannelButton(true, Color.Crimson);
            }
        }
Example #4
0
        private void openSavedScheduleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var openSavedFile = new OpenFileDialog
            {
                DefaultExt = "(*.xml, *.zip)|*.xml;*.zip",
                Filter     = @"XML/ZIP Files|*.xml;*.zip"
            };

            if (openSavedFile.ShowDialog() != DialogResult.OK || openSavedFile.FileName.Length <= 0)
            {
                return;
            }

            var xmlFileName = ZipHelper.UnzipArchiveWithFavourite(openSavedFile.FileName);

            XmlFileHelper.ParseFavouriteMedia(xmlFileName, CurrentUserId);

            var userType = new BaseRepository <User>().Get(u => u.Id == CurrentUserId).FirstOrDefault()?.UserType.Id;

            if (userType == (int)EUserType.CLIENT)
            {
                _userWindow.SetReloadChannelButton(true, Color.Crimson);
            }
        }