Esempio n. 1
0
        void PrepareTask(ApplicationJumpTaskWrap task)
        {
            IApplicationJumpTaskInfoInternal taskInternal = task.ApplicationJumpTask;

            if (taskInternal.IsInitialized)
            {
                return;
            }
            string iconResourceName;

            if (task.ApplicationJumpTask.Icon == null)
            {
                task.IconResourcePath  = task.ApplicationJumpTask.IconResourcePath;
                task.IconResourceIndex = task.ApplicationJumpTask.IconResourceIndex;
                iconResourceName       = string.Format("{0}_{1}", task.IconResourcePath, task.IconResourceIndex);
            }
            else
            {
                if (task.ApplicationJumpTask.IconResourcePath != null)
                {
                    throw new ApplicationJumpTaskBothIconAndIconResourcePathSpecifiedException();
                }
                string iconResourcePath;
                if (!IconStorage.TryStoreIconToFile(task.ApplicationJumpTask.Icon, NativeResourceManager.ExpandVariables(IconStorageFolder), out iconResourceName, out iconResourcePath))
                {
                    throw new ApplicationJumpTaskInvalidIconException();
                }
                task.IconResourcePath  = iconResourcePath;
                task.IconResourceIndex = 0;
            }
            if (task.ApplicationJumpTask.CommandId == null)
            {
                taskInternal.SetAutoGeneratedCommandId(string.Format("{0}${1}${2}", task.ApplicationJumpTask.CustomCategory, task.ApplicationJumpTask.Title, iconResourceName));
            }
        }
        protected override void TearDownCore()
        {
            string resourcesFolder = NativeResourceManager.ExpandVariables(NativeResourceManager.ResourcesFolder);

            if (Directory.Exists(resourcesFolder))
            {
                Directory.Delete(resourcesFolder, true);
            }
            NativeResourceManager.ProductNameOverride = null;
            NativeResourceManager.CompanyNameOverride = null;
            NativeResourceManager.VersionOverride     = null;
            base.TearDownCore();
        }
Esempio n. 3
0
        protected virtual string GetLauncherPath()
        {
            if (!string.IsNullOrEmpty(CustomLauncherPath))
            {
                return(NativeResourceManager.ExpandVariables(CustomLauncherPath));
            }
            string filePath = Path.Combine(NativeResourceManager.ExpandVariables(DefaultLauncherStorageFolder), "DevExpress.Mvvm.UI.ApplicationJumpTaskLauncher" + AssemblyInfo.VSuffix + ".exe");

            if (File.Exists(filePath) && NativeResourceManager.GetFileTime(filePath) > NativeResourceManager.GetApplicationCreateTime())
            {
                return(filePath);
            }
            Directory.CreateDirectory(Path.GetDirectoryName(filePath));
            Stream stream = AssemblyHelper.GetEmbeddedResourceStream(typeof(JumpActionsManager).Assembly, "DevExpress.Mvvm.UI.ApplicationJumpTaskLauncher.exe", true);

            try {
                File.WriteAllBytes(filePath, StreamHelper.CopyAllBytes(stream));
            } catch (IOException) { } catch (UnauthorizedAccessException) { }
            return(filePath);
        }