internal static void Create(string filePath, long sizeInBytes, Message message, MainWindow window) {
     try {
         if (File.Exists(filePath)) {
             File.Delete(filePath);
         }
         ProcessWrapper.ExecuteDosCmd(String.Format("fsutil file createnew \"{0}\" {1}",
                 filePath, sizeInBytes));
         message.Success(String.Format("{0} \"{1}\"", window.FindResource("SuccessfullyCreated"), filePath));
         return;
     } catch (IOException) { } catch (UnauthorizedAccessException) { }
     message.Error(String.Format("{0} \"{1}\"", window.FindResource("FailedToCreate"), filePath));
 }
 internal void Delete(ListBox lstBoxSendTo, Message message)
 {
     if (lstBoxSendTo.SelectedItems.Count == 0) {
         message.Error(_window.FindResource("SelectedOnItem") as string);
         return;
     }
     FileItem[] sendToListItems = new FileItem[lstBoxSendTo.SelectedItems.Count];
     lstBoxSendTo.SelectedItems.CopyTo(sendToListItems, 0);
     string msg = sendToListItems.Length == 1
         ? _window.FindResource("SureToDelete") + " \"" + sendToListItems[0].Name + "\" " + _window.FindResource("FromSendToMenu")
         : _window.FindResource("SureToDeleteMultiple") + " " + sendToListItems.Length + " " + _window.FindResource("FromSendToMenuMultiple");
     InfoBox infoBox = new InfoBox(msg, _window.FindResource("Delete").ToString(),
         _window.FindResource("WarningMsgTitle").ToString(), InfoBox.DialogType.Question);
     if (infoBox.ShowDialog() != true) return;
     List<string> failedFiles = new List<string>();
     foreach (FileItem sendToFileItem in sendToListItems) {
         string filePath = sendToFileItem.FullName;
         try {
             if (Path.GetExtension(filePath).Equals(".lnk", StringComparison.InvariantCultureIgnoreCase) ||
                 Path.GetExtension(filePath).Equals(".pif", StringComparison.InvariantCultureIgnoreCase)) {
                 if (!System.IO.File.Exists(filePath)) {
                     failedFiles.Add(sendToFileItem.Name);
                     continue;
                 }
             }
             else {
                 failedFiles.Add(sendToFileItem.Name);
                 continue;
             }
             System.IO.File.Delete(filePath);
         }
         catch (IOException) {
             failedFiles.Add(sendToFileItem.Name);
         }
         catch (NullReferenceException) {
             failedFiles.Add(sendToFileItem.Name);
         }
     }
     if (!failedFiles.Any()) return;
     string failedMsg = failedFiles.Count > 1
         ? _window.FindResource("FailedToDelete") + " " + failedFiles.SentenceJoin() +
           " " + _window.FindResource("AreNotShortcutsMultiple")
         : _window.FindResource("FailedToDelete") + " " + failedFiles.SentenceJoin() +
           " " + _window.FindResource("AreNotShortcuts");
     message.Error(failedMsg);
 }
        public MainWindow()
        {
            InitializeComponent();
            _message = new Message(msgContainerBorder, txtMsg);
            string initializeSearch = GetResourceString("InitializingSearch");
            _message.Notify(initializeSearch);
            _sendToBackgroundWorker = (BackgroundWorker) this.FindResource("sendToBackgroundWorker");
            _searchBackgroundWorker = (BackgroundWorker) this.FindResource("searchBackgroundWorker");
            _updateCheckBackgroundWorker = (BackgroundWorker) this.FindResource("updateCheckBackgroundWorker");
            _selectionColor = _defaultSelectionColor;
            _searcher = new Searcher(this);
            FocusSearchCommand.InputGestures.Add(new KeyGesture(Key.F, ModifierKeys.Control));
            _message.Hide();
            _hasTabLoadedDict = new Dictionary<string, bool>();
            UpdateLanguageMenu();
            _sendToTask = new SendToTask(this);

            mainWindow.SourceInitialized += new EventHandler(OnWindowSourceInitialized);
            cmboBxFileSizes.ItemsSource = CreateFileTask.SizeDataDict;
            LoadTab(Constants.Explorer);
            CheckForUpdate();
        }