Ejemplo n.º 1
0
        private static bool CheckContextMenuEntries()
        {
            if (VistaSecurity.IsAdmin())
            {
                Process context = new Process();
                context.StartInfo.FileName = ProgramPath + "\\ContextMenu.exe";
                context.Start();
                return(false);
            }

            if (AreCorrectContextMenuEntries())
            {
                return(false);
            }

            if (MessageBox.Show(
                    @"Context menu entries are wrong. Do you want to correct them (recommended)?",
                    @"Wrong context menu entries",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question) == DialogResult.Yes)
            {
                VistaSecurity.RestartElevatedForUpdate();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
 private void UpdateToolStripMenuItemClick(object sender, EventArgs e)
 {
     if (isUpdateable)
     {
         if (MessageBox.Show(
                 @"New version available. Do you want to update (recommended)?",
                 @"New version available :-)",
                 MessageBoxButtons.YesNo,
                 MessageBoxIcon.Question) == DialogResult.Yes)
         {
             VistaSecurity.RestartElevatedForUpdate();
         }
     }
     else
     {
         if (MessageBox.Show(
                 @"New version available. Do you want to download it from SBIP website (recommended)?",
                 @"New version available :-)",
                 MessageBoxButtons.YesNo,
                 MessageBoxIcon.Question) == DialogResult.Yes)
         {
             System.Diagnostics.Process.Start("http://code.google.com/p/sbip/");
         }
     }
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProgramExe  = Application.ExecutablePath;
            ProgramPath =
                Directory.GetParent(Application.ExecutablePath).ToString();
            OptionsFile = Environment.GetFolderPath(
                Environment.SpecialFolder.LocalApplicationData) +
                          "\\SBIP\\options.dat";

            if (args.Length == 1 &&
                args[0] == UpdateArgument &&
                VistaSecurity.IsAdmin())
            {
                AutoUpdater updater = new AutoUpdater(
                    OptionsFile,
                    "http://franknagl.de/updates/SBIP/update.csv",
                    ProgramPath,
                    ProgramExe);
                updater.MakeUpdate();
                return;
            }

            // check (and repair) context menu entries
            if (CheckContextMenuEntries())
            {
                return;
            }

            //Creates only by very first start of SBIP
            if (!File.Exists(OptionsFile))
            {
                CreateOptionsFile(OptionsFile);
            }

            ProcessorForm form;

            // start with parameter
            if (args.Length == 2 && args[1] == "sbip.frank")
            {
                form = new ProcessorForm(args[0]);
            }
            // normal start
            else
            {
                form = new ProcessorForm();
            }

            Application.Run(form);
            //if (form.IsDisposed)
            //{
            //    return;
            //}

            //form.Show();
            //while (form.Created)
            //{
            //    //form.Processor.Render();
            //    //form.UpdateEachFrame(false);
            //    Application.DoEvents();
            //}

            #region TODO Frank Nagl: Delete this region.
            //Bitmap image = new Bitmap("sample1.jpg");

            //// 1. Offline rendering
            //// create Processor, used as rendering framework
            //Processor processor = new Processor();
            //// starts Processor
            //processor.Begin(image);
            //// create RotateChannels filter
            //RotateChannels filter = new RotateChannels();
            //processor.Filter = filter;
            //// optional: configure filter
            //filter.Order = RGBOrder.GBR;
            //// apply the filter
            //Bitmap resultImage = processor.RenderToBitmap();
            ////Texture2D resultTexture = processor.RenderToTexture( );
            //resultImage.Save("RotateChannels.jpg", ImageFormat.Jpeg);
            //processor.End();

            //// 2. Online rendering
            //// create any windows control for rendering in
            //Form myForm = new Form();
            //// create Processor, used as rendering framework
            //Processor processor2 = new Processor();
            //// starts Processor
            //processor2.Begin(image, myForm);
            //// create ExtractChannel filter
            //RotateChannels filter2 = new RotateChannels();
            //processor2.Filter = filter2;
            //// optional: configure filter
            //filter2.Order = RGBOrder.GBR;

            //// apply the filter
            //myForm.Show();
            //while (myForm.Created)
            //{
            //    processor2.Render();
            //    Application.DoEvents();
            //}
            //processor2.End();

            #endregion TODO Frank Nagl: Delete this region.
        }