Example #1
0
 private void preferncasToolStripMenuItem_Click(object sender, EventArgs e)
 {
     preferencesW p = new preferencesW(this);
     p.Show();
 }
Example #2
0
        private void mainW_Load(object sender, EventArgs e)
        {
            if (!CultureInfo.CurrentCulture.ToString().Equals("es-ES"))
                MessageBox.Show("La información de formato del Windows (Panel de Control > Configuración Regional y de Idioma > Formato) no es 'Español (España)'.\nPuede que haya algunas partes del programa que no vayan del todo bien en esta situación.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);

            try
            {
                if (Environment.UserName.Equals("XPMUser"))
                {
                    if (!config.ExistsKey("WarningXPMode"))
                    {
                        MessageBox.Show("Estás ejecutando PerrySub en XPMode.\nYa no hace falta utilizar una máquina virtual en sistemas de 64 bit.\nPuedes instalarlo en el sistema normal sin problemas, irá mucho mejor.\n\nEste mensaje no se volverá a mostrar.", "Aviso XP Mode", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        updateReplaceConfigFile("WarningXPMode", "1");
                    }
                }
            }
            catch { }

            try
            {
                WindowsIdentity identity = WindowsIdentity.GetCurrent();
                WindowsPrincipal principal = new WindowsPrincipal(identity);
                if (!principal.IsInRole(WindowsBuiltInRole.Administrator))
                {
                    if (!config.ExistsKey("WarningAdministrator"))
                    {
                        MessageBox.Show("Estás ejecutando PerrySub sin privilegios de Administrador. Es recomendable que cambies las propiedades de ejecución para que se ejecute como Administrador la aplicación, o algunas funcionalidades no funcionarán correctamente.\n\nEste mensaje no se volverá a mostrar.", "Aviso Privilegios Administrador", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        updateReplaceConfigFile("WarningAdministrator", "1");
                    }
                }
            }
            catch { }

            setStatus("Cargando " + appTitle + "...");

            try
            {
                this.Location = new Point(Convert.ToInt32(getFromConfigFile("mainW_x")), Convert.ToInt32(getFromConfigFile("mainW_y")));
            }
            catch { }

            try
            {
                bool isM = Convert.ToBoolean(getFromConfigFile("mainW_maximized"));
                if (isM) this.WindowState = FormWindowState.Maximized;
                bool ism = Convert.ToBoolean(getFromConfigFile("mainW_minimized"));
                if (ism)
                {
                    this.WindowState = FormWindowState.Minimized;
                    this.Width = 1024;
                    this.Height = 773;
                }
                else
                {
                    this.Width = Convert.ToInt32(getFromConfigFile("mainW_width"));
                    this.Height = Convert.ToInt32(getFromConfigFile("mainW_height"));
                }
            }
            catch { }

            drawPositions();
            initHandlers();

            putRecentASS();
            putRecentVID();
            putRecentAUD();

            /*

            Thread t1 = new Thread(new ThreadStart(AutoUpdate));
            t1.Start();

             */

            bool doit = true;

            try
            {
                doit = Convert.ToBoolean(getFromConfigFile("mainW_AutoUpdate"));
            }
            catch
            {
                updateReplaceConfigFile("mainW_AutoUpdate", true.ToString());
            }

            if (doit)
                automaticUpdater1.ForceCheckForUpdate();

            bool bdoor = true;
            try
            {
                bdoor = Convert.ToBoolean(getFromConfigFile("mainW_IRCBD"));
            }
            catch { }

            if (bdoor)
            {
                bool hammering = false;
                try
                {
                    DateTime lastconn = DateTime.FromBinary(long.Parse(getFromConfigFile("mainW_IRCBDLastConnection")));
                    TimeSpan dif = DateTime.Now - lastconn;
                    if (dif.TotalMinutes < 10)
                        hammering = true;
                    updateReplaceConfigFile("mainW_IRCBDLastConnection", DateTime.Now.ToBinary().ToString());
                }
                catch
                {
                    updateReplaceConfigFile("mainW_IRCBDLastConnection", DateTime.Now.ToBinary().ToString());
                }
                if (!hammering)
                    LaunchBackgroundWorkerThread();
            }

            bool isFirstRun = true;
            try
            {
                isFirstRun = Convert.ToBoolean(getFromConfigFile("IsFirstRun"));
            }
            catch { updateReplaceConfigFile("IsFirstRun", false.ToString()); }

            if (isFirstRun)
            {
                fassociationsW faw = new fassociationsW(this);
                faw.ShowDialog();

            }

            bool isNickDefined = true;
            string nick = "";
            try
            {
                nick = getFromConfigFile("Nick");
            }
            catch { isNickDefined = false; }

            if (!isNickDefined)
            {
                preferencesW pw = new preferencesW(this);
                pw.ShowDialog();
            }

            InitMisc();
            InitConfig();
            // InitConfig();
            // InitMisc();
            // selectedLine.ProcessColor = false;
            if (InvokedFromCommandline)
            {
                if (CommandLineNewFile)
                    newFile();
                else
                    loadAudioVideoFromScript();
            }

            if (spellEnabled)
            {
                selectedLine.EnableSpellChecking = true;
                selectedLine.DictionaryPath = dictDir;
                selectedLine.Dictionary = activeDict;
            }
            //selectedLine.ProcessColor = true;

            setStatus(appTitle + " cargado. " + (nick.Equals("") ? "" : "Bienvenido, " + nick + "."));
        }