public HelpForm()
        {
            InitializeComponent();
            string help = "";

            help     += PupTools.GetSoftwareName(true) + Environment.NewLine;
            help     += "accessory software for PuP-Pack screen tweaking" + Environment.NewLine + Environment.NewLine;
            help     += "Mat D. 03/2019" + Environment.NewLine;
            help     += Environment.NewLine;
            help     += "https://github.com/matd11/PupPackScreenTweaker";
            rtxt.Text = help;
        }
        public static bool CloseCancel()
        {
            string message = "Are you sure you want to exit " + PupTools.GetSoftwareName(false) + " ?";
            string caption = "Exit";
            var    result  = MessageBox.Show(message, caption,
                                             MessageBoxButtons.YesNo,
                                             MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void btnSavePupScreens_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.InitialDirectory = Path.GetDirectoryName(screensPupFile);
            saveFileDialog1.Filter           = "PuP file|*.pup";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (saveFileDialog1.FileName != "")
                {
                    string text;
                    text = PupTools.GetScreenPupHeaders() + Environment.NewLine;
                    foreach (PupScreen pupScreen in pupScreens)
                    {
                        text += pupScreen.GetCsv() + Environment.NewLine;
                    }
                    System.IO.File.WriteAllText(saveFileDialog1.FileName, text);
                    MessageBox.Show(this, "File saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        /// <summary>
        /// load values from PinUpPlayer.ini (dimensions and locations of ref PuP screens, to be used as references)
        /// </summary>
        private void loadReferenceScreens()
        {
            string iniFile = PupTools.FindPuPIniFile();

            try
            {
                refScreens = PupTools.GetPupScreenFromIniFile(iniFile, useTransparentPupFrames);
                refScreens.Add(PupScreens.CreateSpecial99Screen()); // add the virtual "99" screen, used for a screen to refer to itself
                cboRefScreen.Items.Add("");
                foreach (PupScreen ps in refScreens)
                {
                    cboRefScreen.Items.Add(ps.ScreenIndex.ToString());
                }
                cboRefScreen.Items.Add(PupScreens.OTHER_SCREENINDEX);
            }
            catch
            {
                MessageBox.Show(this, "Cannot open/read PinUpPlayer.ini... Exiting", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Example #5
0
        /// <summary>
        /// Load the pup screen instance with values from a csv line from screens.pup
        /// </summary>
        /// <param name="csv"></param>
        public void LoadFromCsv(string csv)
        {
            originalCsv = csv;

            string[] items = PupTools.SplitCsv(csv);
            ScreenIndex = Convert.ToInt16(items[0]);
            Description = items[1];
            PlayList    = items[2];
            Playfile    = items[3];
            Loopit      = (items[4] == "1");
            Active      = items[5];
            Priority    = items[6];
            if (items.Length > 7)
            {
                CustomPos = items[7];
            }
            else
            {
                CustomPos = "";
            }
            Window.SetCaption(PupScreens.DEFAULT_SCREEN_CAPTION + ScreenIndex);
            SetRefScreen(refScreenIndex);
        }
        private void initializeGridList()
        {
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.AutoSize            = false;
            dataGridView1.DataSource          = null;

            // col 0
            DataGridViewColumn column = new DataGridViewTextBoxColumn();

            column.DataPropertyName           = "ScreenIndex";
            column.Name                       = "Num";
            column.Width                      = 30;
            column.ReadOnly                   = true;
            column.DefaultCellStyle.BackColor = readOnlyCellsColor;
            column.Frozen                     = true;
            dataGridView1.Columns.Add(column);

            // col 1
            column = new DataGridViewTextBoxColumn();
            column.DataPropertyName = "Description";
            column.Name             = "Description";
            column.Width            = 110;
            column.Frozen           = true;
            dataGridView1.Columns.Add(column);

            // col 2
            DataGridViewComboBoxColumn combocolumn = new DataGridViewComboBoxColumn();

            combocolumn.DataPropertyName = "Active";
            combocolumn.Name             = "Active";
            combocolumn.Items.AddRange(PupTools.GetActiveModeList());
            combocolumn.FlatStyle = FlatStyle.Flat;
            combocolumn.DefaultCellStyle.BackColor = Color.White;
            dataGridView1.Columns.Add(combocolumn);

            // col 3
            column = new DataGridViewTextBoxColumn();
            column.DataPropertyName           = "CustomPosNOT"; // binding does not work when updated manually
            column.Name                       = "CustomPos";
            column.Width                      = 140;
            column.ReadOnly                   = true;
            column.DefaultCellStyle.BackColor = readOnlyCellsColor;
            dataGridView1.Columns.Add(column);

            // col 4
            column = new DataGridViewTextBoxColumn();
            column.DataPropertyName           = "Playlist";
            column.Name                       = "Playlist";
            column.Width                      = 150;
            column.DefaultCellStyle.BackColor = Color.White;
            column.DefaultCellStyle.Padding   = new Padding(0, 0, 20, 0);
            dataGridView1.Columns.Add(column);

            // col 5
            column = new DataGridViewTextBoxColumn();
            column.DataPropertyName         = "Playfile";
            column.Name                     = "Playfile";
            column.Width                    = 100;
            column.DefaultCellStyle.Padding = new Padding(0, 0, 20, 0);
            dataGridView1.Columns.Add(column);

            // col 6
            column = new DataGridViewCheckBoxColumn();
            column.DataPropertyName = "Loopit";
            column.Width            = 70;
            column.Name             = "Transparent";
            dataGridView1.Columns.Add(column);

            // col 7
            column = new DataGridViewTextBoxColumn();
            column.DataPropertyName = "Priority";
            column.Name             = "Volume%";
            column.Width            = 60;
            dataGridView1.Columns.Add(column);
        }
 private void MainForm_Load(object sender, EventArgs e)
 {
     initializeGridList();
     grpScreenProp.Enabled = false;
     Text = PupTools.GetSoftwareName();
 }
        /// <summary>
        /// load the PuP screens info from a "screens.pup" file
        /// </summary>
        private void loadScreensPupFile()
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter = "PuP file|*.pup";
            openFileDialog1.Title  = "Please pick a screens.pup file to open";
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                screensPupFile = openFileDialog1.FileName;
                killAllWindows(); // in case it's not the first time a file is loaded
                dataGridView1.DataSource = null;
                string errors = "";
                pupScreens = PupTools.GetPupScreensFromPupFile(screensPupFile, useTransparentPupFrames, refScreens, ref errors);
                if (pupScreens == null)
                {
                    MessageBox.Show(this, "Not a valid screens.pup file" + Environment.NewLine + errors, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    // add the invalid ref screens to the drop down list
                    List <int?> invalidScreens = new List <int?>();
                    foreach (PupScreen screen in pupScreens)
                    {
                        if (screen.InvalidScreenReference != null)
                        {
                            bool found = false;
                            foreach (string item in cboRefScreen.Items)
                            {
                                if (item == screen.InvalidScreenReference.ToString())
                                {
                                    found = true;
                                }
                            }
                            if (!found)
                            {
                                invalidScreens.Add(screen.InvalidScreenReference);
                                cboRefScreen.Items.Add(screen.InvalidScreenReference.ToString());
                            }
                        }
                    }
                    if (invalidScreens.Count != 0)
                    {
                        string list = String.Join(", ", invalidScreens.ToArray());
                        MessageBox.Show(this,
                                        "Warning: your screens.pup file contains some definitions using unknown references screens (" + list + ")"
                                        + Environment.NewLine
                                        + "These screens are not defined in your PinUpPlayer.ini file",
                                        "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    pupScreenBindingList     = new BindingList <PupScreen>(pupScreens);
                    pupScreensSource         = new BindingSource(pupScreenBindingList, null);
                    dataGridView1.DataSource = pupScreensSource;

                    foreach (PupScreen pupScreen in pupScreens)
                    {
                        pupScreen.Window.Visible   = pupScreen.Active != "off";
                        pupScreen.PropertyChanged += PupScreenPropertiesChanged;
                        pupScreen.Window.UnauthorizedActivation += UnauthorizedActivationOfPupScreen;
                    }
                    updateAllCustomPosInGrid();

                    enablePropertyControls();

                    if (dataGridView1.Rows.Count > 0)
                    {
                        dataGridView1.Rows[0].Selected = true;
                        selectedPupScreen.Highlight(true);
                        updateScreenPropertiesFields();
                    }
                }
            }
            Focus();
        }