public override void Run()
        {
            IViewContent content = WorkbenchSingleton.Workbench.ActiveViewContent;

            if (content != null)
            {
                if (content.IsViewOnly)
                {
                    return;
                }
                if (content.ContentName == null)
                {
                    SaveFileAs sfa = new SaveFileAs();
                    sfa.Run();
                }
                else
                {
                    FileAttributes attr = FileAttributes.ReadOnly | FileAttributes.Directory | FileAttributes.Offline | FileAttributes.System;
                    if ((File.GetAttributes(content.ContentName) & attr) != 0)
                    {
                        SaveFileAs sfa = new SaveFileAs();
                        sfa.Run();
                    }
                    else
                    {
                        FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
                        fileUtilityService.ObservedSave(new FileOperationDelegate(content.SaveFile), content.ContentName);
                    }
                }
            }
        }
Example #2
0
		public override void Run()
		{
			IViewContent content = WorkbenchSingleton.Workbench.ActiveViewContent;
			if (content != null) 
			{
				if (content.IsViewOnly) 
				{
					return;
				}
				if (content.ContentName == null) 
				{
					SaveFileAs sfa = new SaveFileAs();
					sfa.Run();
				} 
				else 
				{
					FileAttributes attr = FileAttributes.ReadOnly | FileAttributes.Directory | FileAttributes.Offline | FileAttributes.System;
					if ((File.GetAttributes(content.ContentName) & attr) != 0) 
					{
						SaveFileAs sfa = new SaveFileAs();
						sfa.Run();
					} 
					else 
					{
						FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
						fileUtilityService.ObservedSave(new FileOperationDelegate(content.SaveFile), content.ContentName);
					}
				}

			}
		}