Exemplo n.º 1
0
        private void CheckFileAssociations()
        {
            try
            {
                if (FileAssociations == null)
                {
                    return;
                }

                var startupPath        = Application.StartupPath;
                var str1               = FileAssociations.ExtensionOpenWith(".stl");
                var str2               = FileAssociations.ExtensionOpenWith(".obj");
                var associationsDialog = settingsManager.Settings.miscSettings.FileAssociations.ShowFileAssociationsDialog;
                if (str1 == null || str1 != null && !str1.Contains(Application.ExecutablePath) || (str2 == null || str2 != null && !str2.Contains(Application.ExecutablePath)))
                {
                    if (!associationsDialog && !SplashFormFirstRun.WasRunForTheFirstTime)
                    {
                        return;
                    }

                    var associationsForm = new AssociationsForm(settingsManager, messagebox, FileAssociations, Application.ExecutablePath, startupPath + "/Resources/Data\\GUIImages\\M3D32x32Icon.ico");
                }
                else
                {
                    FileAssociations.Set3DFileAssociation(".stl", "STL_M3D_Printer_GUI_file", Application.ExecutablePath, "M3D file (.stl)", startupPath + "/Resources/Data\\GUIImages\\M3D32x32Icon.ico");
                    FileAssociations.Set3DFileAssociation(".obj", "OBJ_M3D_Printer_GUI_file", Application.ExecutablePath, "M3D file (.obj)", startupPath + "/Resources/Data\\GUIImages\\M3D32x32Icon.ico");
                }
            }
            catch (Exception ex)
            {
                ExceptionForm.ShowExceptionForm(ex);
            }
        }