Exemplo n.º 1
0
        public static PupScreens GetPupScreenFromIniFile(string fileName, bool transparentByDefault)
        {
            PupScreens pupScreens = new PupScreens();

            try
            {
                IniManager ini = new IniManager(fileName);
                for (int t = 0; t <= 10; t++)
                {
                    PupScreen pupScreen = new PupScreen(transparentByDefault, null, null);
                    pupScreen.ScreenIndex = t;
                    pupScreen.X           = ini.ReadInt("ScreenXPos", "INFO" + (t == 0 ? "" : t.ToString()));
                    pupScreen.Y           = ini.ReadInt("ScreenYPos", "INFO" + (t == 0 ? "" : t.ToString()));
                    pupScreen.W           = ini.ReadInt("ScreenWidth", "INFO" + (t == 0 ? "" : t.ToString()));
                    pupScreen.H           = ini.ReadInt("ScreenHeight", "INFO" + (t == 0 ? "" : t.ToString()));
                    if (pupScreen.X == -1)
                    {
                        throw(null);
                    }
                    pupScreen.Window.Visible = false;
                    pupScreens.Add(pupScreen);
                }
                if (pupScreens.Count == 0)
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
            return(pupScreens);
        }
Exemplo n.º 2
0
        /// <summary>
        /// build a collection of pup screens, read from a "screens.pup" file
        /// screens.pup format:
        ///  - csv file
        ///  - 1 line of header (ScreenNum,ScreenDes,PlayList,PlayFile,Loopit,Active,Priority,CustomPos)
        ///  - 1 line per screen (usually 10)
        ///  - Example of CustomPos field: "2,0,23.2,100,49.83"
        ///      - Screen ref index
        ///      - X position of screen (%) relatively to ref screen
        ///      - Y position of screen (%) relatively to ref screen
        ///      - Width position of screen (%) relatively to ref screen
        ///      - Height position of screen (%) relatively to ref screen
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="transparentByDefault"></param>
        /// <param name="refScreens"></param>
        /// <returns></returns>
        public static PupScreens GetPupScreensFromPupFile(string fileName, bool transparentByDefault, List <PupScreen> refScreens, ref string errors)
        {
            string[] lines     = System.IO.File.ReadAllLines(fileName);
            int      lineIndex = 0;

            errors = "";
            PupScreens pupScreens = new PupScreens();

            foreach (string line in lines)
            {
                if (lineIndex > 0 && line.Trim() != "")
                {
                    PupScreen pupScreen = new PupScreen(transparentByDefault, Color.Yellow, refScreens);
                    try
                    {
                        pupScreen.LoadFromCsv(line);
                        pupScreen.CalculateRealPos();
                        pupScreens.Add(pupScreen);
                    }
                    catch
                    {
                        errors += "Error in definition of screen line #" + lineIndex + Environment.NewLine;
                    }
                }
                lineIndex++;
            }
            return(errors == "" ? pupScreens : null);
        }
Exemplo n.º 3
0
 private void dataGridView1_SelectionChanged(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 0)
     {
         selectedPupScreen = null;
         foreach (PupScreen pupScreen in pupScreens)
         {
             pupScreen.Highlight(false);                                         // pupScreen.Window.SetColors(false, useTransparentPupFrames, null, Color.Yellow);
         }
     }
     else
     {
         grpScreenProp.Enabled = true;
         int index = Convert.ToInt16(dataGridView1.SelectedRows[0].Cells[0].Value);
         foreach (PupScreen pupScreen in pupScreens)
         {
             if (pupScreen.ScreenIndex == index)
             {
                 selectedPupScreen = pupScreen;
                 pupScreen.Highlight(true);
             }
             else
             {
                 pupScreen.Highlight(false);
             }
         }
         updateScreenPropertiesFields();
         ckLockAR.Checked = false;
         selectedPupScreen.Window.SetAspectRatio(1, false);
         refreshPicButtonStatus();
         Focus();
     }
 }
Exemplo n.º 4
0
        private void SwapListviewItem(int indexA, int indexB)
        {
            dataGridView1.DataSource = null;
            PupScreen tmp = pupScreens[indexA];

            pupScreens[indexA]       = pupScreens[indexB];
            pupScreens[indexB]       = tmp;
            dataGridView1.DataSource = pupScreens;
            updateAllCustomPosInGrid();
            if (!dataGridView1.Rows[indexB].Displayed)
            {
                dataGridView1.FirstDisplayedScrollingRowIndex = indexB;
            }
            dataGridView1.Rows[indexB].Selected = true;
        }
Exemplo n.º 5
0
        private void btnAddGrid_Click(object sender, EventArgs e)
        {
            int index = pupScreens.GetNextAvailableCustomIndex();

            if (index != -1)
            {
                dataGridView1.DataSource = null;
                PupScreen pupScreen = pupScreens.AddOne(index, useTransparentPupFrames, refScreens);
                pupScreen.PropertyChanged += PupScreenPropertiesChanged;
                pupScreen.Window.UnauthorizedActivation += UnauthorizedActivationOfPupScreen;
                dataGridView1.DataSource = pupScreens;
                updateAllCustomPosInGrid();
                dataGridView1.FirstDisplayedScrollingRowIndex             = dataGridView1.Rows.Count - 1;
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;
            }
            else
            {
                MessageBox.Show(this, "Maximum number of screens  already reached!" + Environment.NewLine + "(" + PupScreens.MAX_ALLOWED_SCREENINDEX + " is the max index)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            enablePropertyControls();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create a .res file, used to define custom positioning of a B2S
        /// </summary>
        /// <param name="pupScreen"></param>
        /// <param name="refScreens"></param>
        /// <returns></returns>
        public static string BuildResFile(PupScreen pupScreen, PupScreens refScreens)
        {
            string content = "";

            content += refScreens[3].W.ToString() + Environment.NewLine;
            content += refScreens[3].H.ToString() + Environment.NewLine;
            content += pupScreen.W.ToString() + Environment.NewLine;
            content += pupScreen.H.ToString() + Environment.NewLine;
            content += "@" + refScreens[2].X.ToString() + Environment.NewLine;
            content += (pupScreen.X - refScreens[2].X).ToString() + Environment.NewLine;
            //content += (pupScreen.Y - refScreens[2].Y).ToString() + Environment.NewLine;
            content += (pupScreen.Y - 0).ToString() + Environment.NewLine;
            content += refScreens[1].W.ToString() + Environment.NewLine;
            content += refScreens[1].H.ToString() + Environment.NewLine;
            content += (refScreens[1].X - refScreens[2].X).ToString() + Environment.NewLine;
            content += (refScreens[1].Y - 0).ToString() + Environment.NewLine;
            content += "0" + Environment.NewLine;
            content += (pupScreen.X - refScreens[2].X).ToString() + Environment.NewLine;
            content += (pupScreen.Y - 0).ToString() + Environment.NewLine;
            content += pupScreen.W.ToString();
            content += pupScreen.H.ToString();
            content += "" + Environment.NewLine;
            return(content);
        }