예제 #1
0
파일: Form1.cs 프로젝트: trms/dvd_import
		private void button3_Click(object sender, System.EventArgs e)
		{
            try
            {
                lock (this)
                {
                    List<IFOParse.VOB> vobs = null;
                    IFOParse.ProgramChain pgc = null;
                    List<IFOParse.Cell> cells = null;
                    if (treeView1.SelectedNode == null)
                        return;
                    if (treeView1.SelectedNode.Tag.GetType() == typeof(FileInfo))
                    {
                        // got single vob file
                        FileInfo fi = (FileInfo)treeView1.SelectedNode.Tag;
                        IFOParse.VOB v = new IFOParse.VOB(fi.FullName);
                        vobs = new List<IFOParse.VOB>();
                        vobs.Add(v);

                        // create dummy cell list
                        cells = new List<IFOParse.Cell>();
                        IFOParse.Cell c = new IFOParse.Cell();
                        c.FirstSector = 0;
                        c.LastSector = (int)v.LastSector;
                        cells.Add(c);
                    }
                    else if (treeView1.SelectedNode.Tag.GetType() == typeof(IFOParse.ProgramChain))
                    {
                        pgc = (IFOParse.ProgramChain)treeView1.SelectedNode.Tag;
                        vobs = pgc.Title.VOBs;
                        cells = pgc.Cells;
                    }


                    m_ds = new DSUtils();
                    ArrayList ranges = new ArrayList();
                    ArrayList vobNames = new ArrayList();
                    for (int c = 0; c < cells.Count; c++)
                    {
                        ranges.Add(cells[c].FirstSector);
                        ranges.Add(cells[c].LastSector);
                    }
                    for (int v = 0; v < vobs.Count; v++)
                    {
                        vobNames.Add(vobs[v].FileInfo.FullName);
                        vobNames.Add(vobs[v].Sectors);
                    }
                    m_ds.Preview(ranges, vobNames, panel1.Handle, trackBar1.Value);
                    button3.Enabled = false;
                    button4.Enabled = true;
                    button5.Enabled = true;
                    if (Settings.Default.AudioMode)
                    {
                        label9.Visible = true;
                        label10.Visible = true;
                    }

                    m_videoThread = new Thread(new ThreadStart(PlaybackProgress));
                    m_videoThread.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("Error starting preview: {0}", ex.Message));
            }
		}
예제 #2
0
        protected override DataSet PostGetEntities(DataSet ds)
        {
            DSUtils.ReplaceBooleanColumn("IsActive", ds, 0);

            return(ds);
        }
예제 #3
0
파일: Form1.cs 프로젝트: trms/dvd_import
		private void PlaybackProgress()
		{
            try
            {
                lock (this)
                {
                    if (m_ds == null)
                        return;
                }

                while (true)
                {
                    lock (this)
                    {
                        if (m_ds.IsPlaying() == false)
                            break;
                    }
                    Thread.Sleep(250);
                }

                lock (this)
                {
                    button3.Enabled = true;
                    button4.Enabled = false;
                    button5.Enabled = false;
                    m_ds.Stop();
                    label9.Visible = false;
                    label10.Visible = false;
                    m_ds = null;
                    m_videoThread = null;
                }
            }
            catch { }
		}
        /// <summary>
        /// Builds the cost centers table of validation dataset
        /// </summary>
        /// <param name="tblPhasesHours">the cost centers table in the hours dataset</param>
        /// <param name="tblPhasesCosts">the cost centers table in the costs & sales dataset</param>
        /// <returns>the cost centers table of validation dataset</returns>
        private DataTable BuildValidationCostCentersTable(DataTable tblCostCentersHours, DataTable tblCostCentersCosts)
        {
            if (tblCostCentersHours.Rows.Count != tblCostCentersCosts.Rows.Count)
            {
                throw new IndException(ApplicationMessages.EXCEPTION_NO_ROWS_DIFFERENT);
            }
            DataTable tblCostCenters = new DataTable("tblCostCenters");
            //Create the columns
            DataColumn newCol = new DataColumn("IdProject", typeof(int));

            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("IdPhase", typeof(int));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("IdWP", typeof(int));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("IdCostCenter", typeof(int));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("CostCenterName", typeof(string));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("TotHours", typeof(int));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("Averate", typeof(decimal));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("ValHours", typeof(decimal));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("OtherCost", typeof(decimal));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("Sales", typeof(decimal));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("NetCost", typeof(decimal));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("IdCurrency", typeof(int));
            tblCostCenters.Columns.Add(newCol);
            newCol = new DataColumn("CurrencyCode", typeof(string));
            tblCostCenters.Columns.Add(newCol);
            tblCostCenters.PrimaryKey = new DataColumn[] { tblCostCenters.Columns["IdPhase"], tblCostCenters.Columns["IdWP"], tblCostCenters.Columns["IdCostCenter"] };

            foreach (DataRow hoursRow in tblCostCentersHours.Rows)
            {
                DataRow costsRow = tblCostCentersCosts.Rows.Find(new object[] { hoursRow["IdPhase"], hoursRow["IdWP"], hoursRow["IdCostCenter"] });
                if (costsRow == null)
                {
                    throw new IndException(ApplicationMessages.EXCEPTION_ROWS_DO_NOT_MATCH);
                }
                DataRow phasesRow = tblCostCenters.NewRow();
                phasesRow["IdProject"]      = hoursRow["IdProject"];
                phasesRow["IdPhase"]        = hoursRow["IdPhase"];
                phasesRow["IdWP"]           = hoursRow["IdWP"];
                phasesRow["IdCostCenter"]   = hoursRow["IdCostCenter"];
                phasesRow["CostCenterName"] = hoursRow["CostCenterName"];
                phasesRow["TotHours"]       = hoursRow["NewHours"];
                if (hoursRow["NewVal"] != DBNull.Value && hoursRow["NewHours"] != DBNull.Value)
                {
                    phasesRow["Averate"] = ((int)hoursRow["NewHours"] == 0) ? 0 : decimal.Divide((decimal)hoursRow["NewVal"], (int)hoursRow["NewHours"]);
                }
                else
                {
                    phasesRow["Averate"] = DBNull.Value;
                }
                phasesRow["ValHours"]  = hoursRow["NewVal"];
                phasesRow["OtherCost"] = costsRow["NewCost"];
                phasesRow["Sales"]     = costsRow["NewSales"];

                phasesRow["NetCost"] = DSUtils.SumNullableDecimals(hoursRow["NewVal"], costsRow["NewCost"], costsRow["NewSales"]);

                phasesRow["IdCurrency"]   = hoursRow["IdCurrency"];
                phasesRow["CurrencyCode"] = hoursRow["CurrencyCode"];
                tblCostCenters.Rows.Add(phasesRow);
            }

            return(tblCostCenters);
        }