private void LogError(string message)
        {
            IConfigurationErrorLogService logService         = ServiceHelper.GetConfigurationErrorService(ServiceProvider);
            IUIHierarchyService           uiHierarchyService = ServiceHelper.GetUIHierarchyService(ServiceProvider);

            logService.LogError(new ConfigurationError(uiHierarchyService.SelectedHierarchy.RootNode, message));
        }
예제 #2
0
 /// <summary>
 /// <para>Determines if the current <see cref="FileName"/> can be overwrriten. It will prompt the user throuth the user interface if the user wants to overwrite the file.</para>
 /// </summary>
 /// <returns>
 /// <para><see langword="true"/> if the file can be overwritten; otherwise, <see langword="false"/>.</para>
 /// </returns>
 protected bool CanOverwriteFile()
 {
     if (FileHelper.IsFileReadOnly(fileName))
     {
         IUIService   uiService = ServiceHelper.GetUIService(ServiceProvider);
         DialogResult result    = uiService.ShowMessage(SR.OverwriteFileMessage(fileName), SR.OverwriteFileCaption, System.Windows.Forms.MessageBoxButtons.YesNo);
         if (DialogResult.Yes == result)
         {
             FileHelper.ChangeFileAttributesToWritable(fileName);
         }
         else
         {
             IConfigurationErrorLogService logService = ServiceHelper.GetConfigurationErrorService(ServiceProvider);
             logService.LogError(new ConfigurationError(null, SR.ExceptionFilesNotSaved));
             return(false);
         }
     }
     return(true);
 }