Esempio n. 1
0
        public static void HandleRegApp()
        {
            if (IsAdmin)
            {
                CultureInfo ci = new CultureInfo("en-US");
                Thread.CurrentThread.CurrentCulture   = ci;
                Thread.CurrentThread.CurrentUICulture = ci;

                string strExe  = Assembly.GetExecutingAssembly().Location;
                string command = "\"" + strExe + "\"";
                string icon    = strExe + ",0";

                string appName        = Resources.Resources.program_name;
                string appDescription = Resources.Resources.program_description;

                using (FileAssociator fa = FileAssociator.GetFileAssociator(strDocTypePrefix, strProgName))
                {
                    fa.Register(@"Software\Clients\Media", icon, command, appName, appDescription, GetTypesInfo());
                }
            }
            else
            {
                Elevate("-regapp");
            }
        }
 void AssociateFiles(SettingsForm dlg)
 {
     using (FileAssociator fa = FileAssociator.GetFileAssociator(strDocTypePrefix, strProgName))
     {
         Hashtable table = dlg.SelectedFileTypes;
         foreach (DictionaryEntry entry in table)
         {
             fa.Associate(entry.Key.ToString(), (bool)entry.Value);
         }
     }
 }
Esempio n. 3
0
        private void ButtonBase_OnClick2(object sender, RoutedEventArgs e)
        {
            SettingsProvider.Instance.Global_Settings.StlFile = cb1.IsChecked.Value;
            SettingsProvider.Instance.Global_Settings.ObjFile = cb2.IsChecked.Value;
            SettingsProvider.Instance.Global_Settings.NcFile  = cb3.IsChecked.Value;

            SettingsProvider.Instance.Global_Settings.GFile     = cb4.IsChecked.Value;
            SettingsProvider.Instance.Global_Settings.GcoFile   = cb5.IsChecked.Value;
            SettingsProvider.Instance.Global_Settings.GcodeFile = cb6.IsChecked.Value;

            FileAssociator.AssociateFiles();
        }
Esempio n. 4
0
        public void RegisterFileType()
        {
            var info = new FileTypeRegInfo()
            {
                ExtendName  = ".WXF",
                Description = "WSX Cut Document(.WXF)",
                IcoPath     = Application.StartupPath + @"\Assets\file2.ico",
                ExePath     = Application.StartupPath + @"\WSXCut.exe"
            };

            FileAssociator.RegisterFileType(info);
        }
Esempio n. 5
0
 public static void HandleUnRegApp()
 {
     if (IsAdmin)
     {
         using (FileAssociator fa = FileAssociator.GetFileAssociator(strDocTypePrefix, strProgName))
         {
             fa.Unregister();
         }
     }
     else
     {
         Elevate("-unregapp");
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Register file association
        /// </summary>
        /// <param name="ext">Extension, for ex: .png</param>
        /// <param name="programID">Program ID, for ex: ImageGlass.PNG</param>
        /// <param name="description">Extension description</param>
        /// <param name="icon">.ICO path</param>
        /// <param name="igPath">Executable file</param>
        /// <param name="appName">Application name</param>
        public static void RegisterAssociation(string ext, string programID,
                                               string description, string icon, string igPath, string appName)
        {
            // Initializes a new FileAssociator to associate the .ABC file extension.
            FileAssociator assoc = new FileAssociator(ext);

            // Creates a new file association for the .ABC file extension. Data is overwritten if it already exists.
            assoc.Create(programID,
                         description,
                         new ProgramIcon(icon),
                         new ExecApplication(igPath),
                         new OpenWithList(new string[] { appName }));

            MessageBox.Show("dsgsdg");
        }
        private void OnSettingsPreferences(object sender, EventArgs e)
        {
            bOkToHideCursor = false;
            ShowCursor();

            SettingsForm dlg = new SettingsForm();

            dlg.TopMost = TopMost;
            dlg.Apply  += new EventHandler(OnSettingsApply);

            dlg.AutoPlay      = mediaControl.AutoPlay;
            dlg.VideoRenderer = mediaControl.PreferredVideoRenderer;
            dlg.ShowLogo      = mediaControl.ShowLogo;

            dlg.SystemTray        = nicon.SystemTray;
            dlg.ShowTrayAlways    = nicon.ShowTrayAlways;
            dlg.RememberVolume    = bRememberVolume;
            dlg.StartFullscreen   = bStartFullscreen;
            dlg.CenterWindow      = bCenterWindow;
            dlg.AlwaysOnTop       = bTopMost;
            dlg.ScreenshotsFolder = screenshotsFolder;
            if (!Visible)
            {
                dlg.StartPosition = FormStartPosition.CenterScreen;
            }

            using (FileAssociator fa = FileAssociator.GetFileAssociator(strDocTypePrefix, strProgName))
            {
                string[]  types = dlg.FileTypes;
                Hashtable table = new Hashtable();
                foreach (string type in types)
                {
                    table[type] = fa.IsAssociated(type);
                }
                dlg.SelectedFileTypes = table;
            }

            dlg.KeysTable        = htKeys;
            dlg.MouseWheelAction = wheelAction;

            // dlg.UsePreferredFilters = engine.UsePreferredFilters;
            // dlg.UsePreferredFilters4DVD = engine.UsePreferredFilters4DVD;

            if (ShowMyDialog(dlg) == DialogResult.OK)
            {
                OnSettingsApply(dlg, EventArgs.Empty);
            }
            if (dlg.FileTypesChanged)
            {
                FileAssociator.NotifyShell();
            }
            if (dlg.RestartTriggered)
            {
                MessageBox.Show(String.Format(Resources.Resources.systray_warning_format, "\n"),
                                Resources.Resources.program_name, MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                Close();
            }

            bOkToHideCursor = true;
        }