Пример #1
0
        private void btnVideoAdd_Click(object sender, EventArgs e)
        {
            if (cboVideoLayer.SelectedIndex < 0)
            {
                HDMessageBox.Show("Please selected one layer!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtVideo.Text == "")
            {
                HDMessageBox.Show("Please browse one file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                videoBindingSource.List.Add(new View.Video()
                {
                    VideoObj = new Object.Video()
                    {
                        Layer     = int.Parse(cboVideoLayer.Text),
                        VideoPath = txtVideo.Text,
                        Loop      = ckVideoLoop.Checked
                    }
                });

                (videoBindingSource.List as BindingList <View.Video>).Select(v => v.VideoObj).ToList().SaveObject(_videoXmlPath);
            }
        }
Пример #2
0
 private void btnUpdateRealTime_Click(object sender, EventArgs e)
 {
     try
     {
         var templateName = "HDTemplates\\Update\\" + _tempName;
         if (txtIcon1.Text.Length > 0)
         {
             _xmlAdd += Add("icon1", Path.Combine(Path.Combine(AppSetting.Default.MediaFolder, "Icons"), txtIcon1.Text));
         }
         if (txtIcon2.Text.Length > 0)
         {
             _xmlAdd += Add("icon2", Path.Combine(Path.Combine(AppSetting.Default.MediaFolder, "Icons"), txtIcon2.Text));
         }
         if (txtColor.Text.Length > 0)
         {
             _xmlAdd += Add("image", Path.Combine(AppSetting.Default.MediaFolder, txtColor.Text));
         }
         _xml = footballPlayer.GetProperties();
         var    fieldName = _xml.Replace("&lt;", "<").Replace("&gt;", ">").Replace("&quot;", "\"").Replace("<string>", "").Replace("</string>", "").Replace("~", "");
         string xmlStr    = "<Track_Property>" + _xmlAdd + fieldName.Replace("<Track_Property>", "");
         UpdateDataFile(xmlStr);
         this.Clear();
         if (footballPlayer.Add(1, templateName))
         {
             footballPlayer.Update(1, xmlStr.Replace("\\n", "\n"));
             footballPlayer.Refresh();
         }
     }
     catch
     {
         HDMessageBox.Show("Data not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #3
0
        private void cboTemplateType_SelectedValueChanged(object sender, EventArgs e)
        {
            var xmlFileName = "template_" + Utils.ConvertToVietnameseNonSign(cboTemplateType.Text).Replace(" ", "").ToLower() + "_list.xml";

            templatesXmlPath = Path.Combine(Application.StartupPath, xmlFileName);
            try
            {
                if (File.Exists(templatesXmlPath))
                {
                    var lstTemplate = Utils.GetObject <List <Object.Template> >(templatesXmlPath);
                    foreach (var temp in lstTemplate)
                    {
                        bsManageTemplate.Add(new View.Template()
                        {
                            TempObj = temp
                        });
                    }
                }
                else
                {
                    File.Create(templatesXmlPath).Dispose();
                }
            }
            catch (Exception ex)
            {
                HDMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #4
0
        private void btnVideoSave_Click(object sender, EventArgs e)
        {
            if (gvVideo.FocusedRowHandle < 0)
            {
                HDMessageBox.Show("Selected file need override!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (cboVideoLayer.SelectedIndex < 0)
            {
                HDMessageBox.Show("Selected layer!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtVideo.Text == "")
            {
                HDMessageBox.Show("Browse one file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                var videoView = gvVideo.GetFocusedRow() as View.Video;

                videoView.VideoObj.Layer     = int.Parse(cboVideoLayer.Text);
                videoView.VideoObj.VideoPath = txtVideo.Text;
                videoView.VideoObj.Loop      = ckVideoLoop.Checked;

                grdVideo.RefreshDataSource();

                (videoBindingSource.List as BindingList <View.Video>).Select(v => v.VideoObj).ToList().SaveObject(_videoXmlPath);
            }
        }
Пример #5
0
 private void btnChooseFolder_Click(object sender, EventArgs e)
 {
     if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
     {
         var lstFiles = Directory.EnumerateFiles(folderBrowserDialog1.SelectedPath).Where(f => AppSettings.Default.FileFilter.Contains(Path.GetExtension(f)));
         var lstFile  = bsFiles.List as BindingList <View.FileView>;
         foreach (var i in lstFiles)
         {
             if (lstFile.Where(f => f.Name.ToLower() == i.ToLower()).FirstOrDefault() != null)
             {
                 HDMessageBox.Show("File " + i + " đã có trong danh sách công việc!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 bsFiles.List.Add(new View.FileView
                 {
                     Name   = i,
                     Status = "Đang chờ..."
                 });
             }
         }
         txtFolder.Text = folderBrowserDialog1.SelectedPath;
         (bsFiles.List as BindingList <View.FileView>).ToList().SaveObject(fileListPath);
     }
 }
Пример #6
0
        public void LoadTemplateHost(string path)
        {
            if (!Directory.Exists(Path.GetDirectoryName(path)))
            {
                HDMessageBox.Show("Template folder does not exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (!File.Exists(path))
            {
                HDMessageBox.Show("Template host file does not exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                footballPlayer.Clear();

                if (path.Contains("43"))
                {
                    footballPlayer.AspectControl = CGPreviewControl.FlashTemplateHostControl.Aspects.Aspect43;
                }
                else
                {
                    footballPlayer.AspectControl = CGPreviewControl.FlashTemplateHostControl.Aspects.Aspect169;
                }

                footballPlayer.TemplateHost = path;
                footballPlayer.Add(0, "HDTemplates/HDVietNam.ft", true);

                _TemplateHost = path;
            }
        }
Пример #7
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtSQLQuery.Text.Trim().Length > 10 && txtSQLQueryFiles.Text.Trim().Length > 10)
                {
                    bsDBConfig.Clear();
                    bsDBConfig.List.Add(new View.DBCommandObj
                    {
                        SQLQuery      = txtSQLQuery.Text,
                        SQLQueryFiles = txtSQLQueryFiles.Text,
                        SQLQueryPic   = txtSQLQueryPic.Text,
                    });

                    (bsDBConfig.List as BindingList <View.DBCommandObj>).ToList().SaveObject(dbCommandPath);
                    HDMessageBox.Show("Cấu hình thành công! Hãy khởi động lại phần mềm để sử dụng cấu hình mới!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    HDMessageBox.Show("Các trường (*) là bắt buộc!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                HDMessageBox.Show("Cấu hình thất bại! Mời cấu hình lại hoặc khởi động lại phần mềm!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #8
0
 private void btnDone_Click(object sender, EventArgs e)
 {
     #region Đăng nhập
     using (var db = new SqlConnection(connectionStr))
     {
         try
         {
             var userDB = db.Query <DAO.SYSTEM_USERS>(@"Select * from SYSTEM_USERS where USER_NAME=@username and PASSWORD=@password", new { username = txtUsername.Text, password = MD5Hash(MD5Hash(txtPwd.Text)) }).FirstOrDefault();
             if (userDB != null)
             {
                 userConfigFileName = "user" + userDB.USER_ID.ToString() + "Config.xml";
                 HDMessageBox.Show("Lưu cấu hình cho người dùng " + userDB.USER_NAME + " thành công!", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
             else
             {
                 HDMessageBox.Show("Sai thông tin đăng nhập, mời thử lại!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             HDMessageBox.Show(ex.ToString());
         }
     }
     #endregion
 }
Пример #9
0
        private void btnAddTennisTemplate_Click(object sender, EventArgs e)
        {
            try
            {
                if (cboTennisLayer.SelectedIndex < 0)
                {
                    HDMessageBox.Show("Please selected one layer!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    bsTennisTemplates.List.Add(new View.tempInfo()
                    {
                        tempObj = new Object.tempInfo()
                        {
                            Layer        = int.Parse(cboTennisLayer.Text),
                            TemplateName = lbTennisTemplates.SelectedValue.ToString(),
                            Duration     = int.Parse(nTennisDuration.Text),
                            Delay        = int.Parse(nTennisDelay.Text)
                        }
                    });

                    (bsTennisTemplates.List as BindingList <View.tempInfo>).Select(v => v.tempObj).ToList().SaveObject(_tempTennisInfoXmlPath);
                }
            }
            catch
            {
                HDMessageBox.Show("Please select a Template!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #10
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     try
     {
         if (!cgServer.Connect())
         {
             HDMessageBox.Show("Not connect to cg server!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             List <Object.Property> runtimeProperties = new List <Object.Property>();
             runtimeProperties.Add(new Object.Property()
             {
                 Name  = "Loops",
                 Value = "false"
             });
             System.Threading.Timer timer = null;
             timer = new System.Threading.Timer((obj) =>
             {
                 OnTemplate(_layer, _tempName, 1, null, runtimeProperties);
                 timer.Dispose();
             },
                                                null, _delay, Timeout.Infinite);
         }
     }
     catch
     {
         HDMessageBox.Show("Please add a Template!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #11
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtName.Text.Trim().Length == 0 || txtFileName.Text.Trim().Length == 0)
                {
                    HDMessageBox.Show("Tên đại diện và Tên template không được để trống!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    bsManageTemplate.List.Add(new View.Template()
                    {
                        TempObj = new Object.Template()
                        {
                            Name     = txtName.Text,
                            FileName = txtFileName.Text
                        }
                    });

                    (bsManageTemplate.List as BindingList <View.Template>).Select(v => v.TempObj).ToList().SaveObject(templatesXmlPath);
                }
            }
            catch (Exception ex)
            {
                HDMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #12
0
        private void btnOnVideo_Click(object sender, EventArgs e)
        {
            if (cboVideoLayer.SelectedIndex < 0)
            {
                HDMessageBox.Show("Please select one layer", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtVideo.Text == "")
            {
                HDMessageBox.Show("Please select file to play", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                CasparCGDataCollection cgData            = new CasparCGDataCollection();
                List <Object.Property> runtimeProperties = new List <Object.Property>();
                runtimeProperties.Add(new Object.Property()
                {
                    Name  = "VideoPath",
                    Value = txtVideo.Text
                });

                runtimeProperties.Add(new Object.Property()
                {
                    Name  = "Loops",
                    Value = ckVideoLoop.Checked ? "true" : "false"
                });

                OnTemplate(int.Parse(cboVideoLayer.Text), "PlayVideo", 0, null, runtimeProperties);
            }
        }
Пример #13
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         SaveFileDialog saveFileDialog1 = new SaveFileDialog();
         saveFileDialog1.InitialDirectory = AppSettings.Default.ImportFolder;
         saveFileDialog1.Filter           = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
         saveFileDialog1.FileName         = txtFileName.Text;
         if (saveFileDialog1.ShowDialog() == DialogResult.OK)
         {
             List <View.exObj> lstInfo = new List <View.exObj>();
             foreach (var i in bsExcelInfo.List as BindingList <View.exObj> )
             {
                 lstInfo.Add(i);
             }
             var tempPath = Path.Combine(AppSettings.Default.ImportFolder, saveFileDialog1.FileName);
             if (tempPath.EndsWith(".xlsx"))
             {
                 View.infoXlsx InfoObj = new View.infoXlsx();
                 InfoObj.DataSource = lstInfo;
                 InfoObj.CreateDocument();
                 InfoObj.ExportToXlsx(tempPath);
             }
             else
             {
                 (bsExcelInfo.List as BindingList <View.exObj>).ToList().SaveObject(tempPath);
             }
         }
     }
     catch (Exception ex)
     {
         HDMessageBox.Show(ex.ToString(), "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #14
0
        private void btnChooseFiles_Click(object sender, EventArgs e)
        {
            string fileFilters = AppSettings.Default.FileFilter;

            this.openFileDialog1.Multiselect = true;
            this.openFileDialog1.Filter      = "Videos (" + fileFilters + ")|" + fileFilters + "|All files (*.*)|*.*";
            this.openFileDialog1.Title       = "Chọn file media...";
            if (fileFilters.Trim().Length <= 3)
            {
                HDMessageBox.Show("Chưa có chuỗi lọc Files, cấu hình phần mềm trước!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                var lstFile = bsFiles.List as BindingList <View.FileView>;

                foreach (var i in openFileDialog1.FileNames)
                {
                    if (lstFile.Where(f => f.Name.ToLower() == i.ToLower()).FirstOrDefault() != null)
                    {
                        HDMessageBox.Show("File " + i + " đã có trong danh sách công việc!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        bsFiles.List.Add(new View.FileView
                        {
                            Name   = i,
                            Status = "Đang chờ..."
                        });
                        txtFiles.Text += i + ";";
                    }
                }
                this.txtFiles.ToolTip = txtFiles.Text;
                (bsFiles.List as BindingList <View.FileView>).ToList().SaveObject(fileListPath);
            }
        }
Пример #15
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtImport.Text.Trim().Length > 2 && txtExport.Text.Trim().Length > 3)
                {
                    AppSettings.Default.ImportFolder = txtImport.Text;
                    AppSettings.Default.ExportFolder = txtExport.Text;
                    bsConfig.Clear();
                    bsConfig.List.Add(new View.Config
                    {
                        ImportFolder = txtImport.Text,
                        ExportFolder = txtExport.Text
                    });

                    (bsConfig.List as BindingList <View.Config>).ToList().SaveObject(configPath);
                    HDMessageBox.Show("Cấu hình thành công!", "Thông tin", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    HDMessageBox.Show("Chưa cấu hình phần mềm", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                HDMessageBox.Show("Cấu hình thất bại! Mời cấu hình lại hoặc khởi động lại phần mềm!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #16
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            try
            {
                lstResult.Clear();
                using (var db = new SqlConnection(AppSettings.Default.ConnectionString))
                {
                    var    lstConfig = db.Query <string>(@"select CONTENT from SYSTEM_USER_FILTER_PROFILE where NAME=@Name", new { Name = filterOption });
                    String miConfig  = lstConfig.FirstOrDefault();
                    Dictionary <String, String> mediaInfo = new Dictionary <string, string>();
                    MIConfig MIConfig = JsonConvert.DeserializeObject <MIConfig>(miConfig);
                    bool     isValid  = false;
                    MIUtil   mi       = new MIUtil(MIConfig.Inform, MIConfig.Filter);

                    try
                    {
                        for (int i = 0; i < gvFiles.DataRowCount; i++)
                        {
                            var tempFile = gvFiles.GetRow(i) as View.FileView;
                            mi.Infor(Path.GetFullPath(tempFile.Name));
                            mediaInfo = mi.MediaInfo();
                            isValid   = mi.Validate();
                            if (isValid)
                            {
                                tempFile.Status = "Hợp lệ";
                                String log = "";
                                log += "File: " + tempFile.Name + "; Can read: " + new FileInfo(tempFile.Name).Length;
                                //log += "\n" + MIConfig.Inform.ToMediaInfom();
                                log += "\n" + PrintMediaInfo(mediaInfo);
                                ResultLoggingLocal(tempFile.Name, log);
                                lstResult.Add(log);
                            }
                            else
                            {
                                List <InvalidInfo> invalids = mi.Invalids;
                                String             log      = "";
                                log += "File: " + tempFile.Name + "; Can read: " + new FileInfo(tempFile.Name).Length;
                                //log += "\n\n" + MIConfig.Inform.ToMediaInfom();
                                log += "\n\n" + PrintMediaInfo(mediaInfo);
                                log += "\n\n" + PrintInvalids(invalids);
                                ResultLoggingLocal(tempFile.Name, log);
                                tempFile.Status = "Không hợp lệ";
                                lstResult.Add(log);
                            }
                        }
                        gvFiles.RefreshData();
                        rtbReport.Text = lstResult[gvFiles.FocusedRowHandle];
                    }
                    catch (Exception ex)
                    {
                        HDMessageBox.Show(ex.ToString(), "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                HDMessageBox.Show(ex.ToString(), "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #17
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(AppSettings.Default.ImportFolder))
            {
                HDMessageBox.Show("Thư mục Import không tồn tại", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                OpenFileDialog open = new OpenFileDialog();
                open.Filter           = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
                open.InitialDirectory = AppSettings.Default.ImportFolder;
                if (open.ShowDialog() == DialogResult.OK)
                {
                    txtFileName.Text = open.SafeFileName;
                    if (!open.FileName.EndsWith(".xlsx"))
                    {
                        HDMessageBox.Show("Định dạng file không đúng chuẩn .xlsx", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    else
                    {
                        try
                        {
                            using (var fs = new FileStream(open.FileName, FileMode.Open, FileAccess.Read))
                            {
                                var wb = new XSSFWorkbook(fs);
                                var sh = (XSSFSheet)wb.GetSheetAt(0);

                                bsExcelInfo.List.Clear();
                                for (int i = 1; i <= sh.LastRowNum; i++)
                                {
                                    try
                                    {
                                        View.exObj temp = new View.exObj();
                                        temp.Field  = sh.GetRow(i).GetCell(0).ToString();
                                        temp.Detail = sh.GetRow(i).GetCell(1).ToString();

                                        bsExcelInfo.List.Add(temp);
                                        (bsExcelInfo.List as BindingList <View.exObj>).ToList().SaveObject(excelInfoPath);
                                    }
                                    catch //(Exception ex)
                                    {
                                        //HDMessageBox.Show(ex.ToString(), "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            HDMessageBox.Show(ex.ToString(), "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
Пример #18
0
 private void btnOffVideo_Click(object sender, EventArgs e)
 {
     if (cboVideoLayer.SelectedIndex < 0)
     {
         HDMessageBox.Show("Please select one layer", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         OffTemplate(int.Parse(cboVideoLayer.Text));
     }
 }
Пример #19
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     try
     {
         Dictionary <string, string> dicXml = new Dictionary <string, string>();
         foreach (var i in bsExcelInfo.List as BindingList <View.exObj> )
         {
             dicXml.Add(i.Field.Trim(), i.Detail.Trim());
         }
         View.xmlObj xml = new View.xmlObj()
         {
             Channel             = dicXml["Kênh"],
             Type                = dicXml["Chuyên mục"],
             ProgramName         = dicXml["Tên chương trình"],
             ExternalProgramName = dicXml["Tên chương trình mở rộng"],
             Season              = dicXml["Phần"],
             Episode             = dicXml["Tập"],
             Content             = dicXml["Nội dung"],
             BroadcastDate       = dicXml["Thời gian phát sóng"],
             TimeToLive          = dicXml["Thời gian tồn tại"],
             Copyrighted         = dicXml["Bản quyền"],
             CopyrightedStart    = dicXml["Ngày bắt đầu bản quyền"],
             CopyrightedEnd      = dicXml["Ngày kết thúc bản quyền"],
             StartTimeCode       = dicXml["TCin"],
             EndTimeCode         = dicXml["TCout"],
             WorkflowID          = dicXml["Workflow"],
             Director            = dicXml["Đạo diễn"],
             Actor               = dicXml["Diễn viên"],
             Year                = dicXml["Năm khởi chiếu"],
             CopyrightsScale     = "Sử dụng cho VOD",
             ProductionUnit      = dicXml["Đơn vị sản xuất"],
             ProductionCountry   = dicXml["Nước sản xuất"],
             Language            = dicXml["Ngôn ngữ"],
             Awards              = " ",
             Keyword             = dicXml["Từ khóa"],
             DistributorUnit     = dicXml["Đơn vị phân phối"],
             ParentalRating      = dicXml["Giới hạn độ tuổi"],
             StarRating          = dicXml["Chấm điểm"]
         };
         if (!Directory.Exists(AppSettings.Default.ExportFolder))
         {
             HDMessageBox.Show("Chưa cấu hình thư mục Export XML", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             xml.SaveObject(Path.Combine(AppSettings.Default.ExportFolder, txtFileName.Text + ".xml"));
             System.Diagnostics.Process.Start(AppSettings.Default.ExportFolder);
         }
     }
     catch (Exception ex)
     {
         HDMessageBox.Show(ex.ToString(), "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #20
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     try
     {
         var tempInfoView = gvFootballPlaylist.GetFocusedRow() as View.tempInfo;
         OffTemplate(tempInfoView.tempObj.Layer);
     }
     catch
     {
         HDMessageBox.Show("404 - Template not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #21
0
        private void btnVideoRemove_Click(object sender, EventArgs e)
        {
            if (gvVideo.FocusedRowHandle < 0)
            {
                HDMessageBox.Show("Selected file need remove", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                videoBindingSource.List.Remove(gvVideo.GetFocusedRow());

                (videoBindingSource.List as BindingList <View.Video>).Select(v => v.VideoObj).ToList().SaveObject(_videoXmlPath);
            }
        }
Пример #22
0
 private void gvFiles_RowCellClick(object sender, RowCellClickEventArgs e)
 {
     try
     {
         if (e.Button == MouseButtons.Left && e.Clicks == 1)
         {
             rtbReport.Text = lstResult[gvFiles.FocusedRowHandle];
         }
     }
     catch
     {
         HDMessageBox.Show("Bạn chưa kiểm tra file này, không thể xem được thông tin!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #23
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     try
     {
         lstResult.Clear();
         bsFiles.Clear();
         txtFiles.ResetText();
         txtFolder.ResetText();
         rtbReport.ResetText();
     }
     catch (Exception ex)
     {
         HDMessageBox.Show(ex.ToString(), "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #24
0
        private void btnEditTemplate_Click(object sender, EventArgs e)
        {
            try
            {
                var templateName = "HDTemplates\\" + getTemplateName(_tempName);
                var frmInput     = new PreviewForm(templateName);

                frmInput.LoadTemplateHost(Path.Combine(AppSetting.Default.TemplateFolder, "cg20.fth.1080i5000"));

                UpdateTemplate(frmInput, _tempName);
            }
            catch (Exception ex)
            {
                HDMessageBox.Show("404 NOT FOUND: " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #25
0
        public string UpdateTemplate(PreviewForm frmInput, string templateFileName, int fadeUpDuration = 0)
        {
            string templateFile = "HDTemplates\\" + templateFileName;
            var    lstData      = Utils.GetObject <List <Object.tempUpdating> >(_updateDataXml);

            dicTemplateData.Clear();
            foreach (var data in lstData)
            {
                dicTemplateData.Add(data.Name, data.Data);
            }
            try
            {
                int nTry = 0;

TryHere:

                if (frmInput.player.Add(1, templateFile))
                {
                    if (dicTemplateData.ContainsKey("HDTemplates\\" + templateFileName))
                    {
                        frmInput.player.Update(1, dicTemplateData["HDTemplates\\" + templateFileName].Replace("\\n", "\n"));
                    }
                    frmInput.player.Refresh();
                    frmInput.player.InvokeMethod(1, "fadeUp");

                    frmInput.Show();
                    frmInput.Activate();
                }
                else
                {
                    nTry++;
                    if (nTry < 1)
                    {
                        frmInput.Clear();
                        goto TryHere;
                    }
                    throw new Exception("Can not cue graphics!");
                }
            }
            catch
            {
                HDMessageBox.Show("Can't edit this template!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(templateFile);
        }
Пример #26
0
        private void btnRemoveTennisTemplates_Click(object sender, EventArgs e)
        {
            try
            {
                if (gvTennisPlaylist.FocusedRowHandle < 0)
                {
                    HDMessageBox.Show("404 - Not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    bsTennisTemplates.List.Remove(gvTennisPlaylist.GetFocusedRow());

                    (bsTennisTemplates.List as BindingList <View.tempInfo>).Select(v => v.tempObj).ToList().SaveObject(_tempTennisInfoXmlPath);
                }
            }
            catch (Exception ex) {
                HDMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #27
0
        private void UpdateDataFile(string data)
        {
            try
            {
                if (bsUpdateData.List.Count > 0)
                {
                    int dataCount = 0;
                    foreach (var temp in bsUpdateData.List as BindingList <Object.tempUpdating> )
                    {
                        if (temp.Name == _tempName)
                        {
                            dataCount++;
                            temp.Data = data;
                            (bsUpdateData.List as BindingList <Object.tempUpdating>).ToList().SaveObject(_updateDataXml);
                        }
                    }
                    if (dataCount == 0)
                    {
                        bsUpdateData.List.Add(new Object.tempUpdating()
                        {
                            Name = _tempName,
                            Data = data
                        });

                        (bsUpdateData.List as BindingList <Object.tempUpdating>).ToList().SaveObject(_updateDataXml);
                    }
                }
                else
                {
                    bsUpdateData.List.Add(new Object.tempUpdating()
                    {
                        Name = _tempName,
                        Data = data
                    });

                    (bsUpdateData.List as BindingList <Object.tempUpdating>).ToList().SaveObject(_updateDataXml);
                }
            }
            catch (Exception ex)
            {
                HDMessageBox.Show("UpdateDataFile lỗi: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #28
0
 private void btnChooseExport_Click(object sender, EventArgs e)
 {
     try
     {
         FolderBrowserDialog fbd = new FolderBrowserDialog();
         if (txtExport.Text != null && txtExport.Text != "")
         {
             if (Directory.Exists(Path.GetFullPath(txtExport.Text)))
             {
                 fbd.SelectedPath = Path.GetFullPath(txtExport.Text);
             }
         }
         if (fbd.ShowDialog() == DialogResult.OK)
         {
             txtExport.Text = fbd.SelectedPath;
         }
     }
     catch (Exception ex)
     {
         HDMessageBox.Show(ex.ToString(), "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #29
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtSQLQuery.Text.Trim().Length > 10 && txtSQLQueryHighresFile.Text.Trim().Length > 10)
                {
                    bsDBConfig.Clear();
                    bsDBConfig.List.Add(new View.DBCommandObj
                    {
                        SQLQuery                    = txtSQLQuery.Text,
                        SQLQueryHighresFile         = txtSQLQueryHighresFile.Text,
                        SQLQueryLowresFile          = txtSQLQueryLowres.Text,
                        SQLQueryHighresOriginalFile = txtSQLQueryHighresOriginal.Text,
                        SQLQueryAudio               = txtSQLQueryAudioFile.Text,
                        SQLQueryAudioOriginal       = txtSQLAudioOriginal.Text,
                        SQLQueryMetadata            = txtSQLQueryMetadata.Text,
                        SQLUpdateStatus             = txtQueryUpdateStatus.Text,
                        SQLQueryPreview             = txtSQLPreview.Text,
                        SQLQueryImage               = txtSQLImage.Text,
                        SQLQueryMail                = txtSQLMail.Text,
                        SQLQuerySubtitle            = txtSQLQuerySubtitle.Text,
                        SQLQueryXmlOriginal         = txtSQLQueryXmlOriginal.Text
                    });

                    (bsDBConfig.List as BindingList <View.DBCommandObj>).ToList().SaveObject(dbCommandPath);
                    HDMessageBox.Show("Cấu hình thành công! Hãy khởi động lại phần mềm để sử dụng cấu hình mới!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    HDMessageBox.Show("Các trường (*) là bắt buộc!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                HDMessageBox.Show("Cấu hình thất bại! Mời cấu hình lại hoặc khởi động lại phần mềm!", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #30
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                if (gridView1.FocusedRowHandle < 0)
                {
                    HDMessageBox.Show("Chưa chọn template để xóa!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    var temp = gridView1.GetFocusedRow() as View.Template;
                    if (HDMessageBox.Show("Bạn chắc chắn xóa " + temp.TempObj.Name) == DialogResult.OK)
                    {
                        bsManageTemplate.List.Remove(gridView1.GetFocusedRow());

                        (bsManageTemplate.List as BindingList <View.Template>).Select(v => v.TempObj).ToList().SaveObject(templatesXmlPath);
                    }
                }
            }
            catch (Exception ex)
            {
                HDMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }