protected void conflictsView_SelectedIndexChanged(object sender, System.EventArgs e) { resolveNameLabel.Text = resourceManager.GetString("resolveNameLabel.Text"); newName.Enabled = resolveName.Enabled = true; newName.Text = string.Empty; fixNames = true; if (conflictsView.SelectedItems.Count == 0) { serverPanel.Visible = localPanel.Visible = true; nameConflict.Visible = false; conflicts = null; localName.Text = serverName.Text = localDate.Text = serverDate.Text = localSize.Text = serverSize.Text = ""; saveLocal.Enabled = saveServer.Enabled = false; } else if (conflictsView.SelectedItems.Count == 1) { conflicts = (Conflicts)conflictsView.SelectedItems[0].Tag; if ((conflicts.ServerConflict != null) && !conflicts.ServerConflict.IsNameConflict) { serverPanel.Visible = localPanel.Visible = true; nameConflict.Visible = false; localName.Text = conflicts.ServerConflict.LocalName; localDate.Text = conflicts.ServerConflict.LocalDate; localSize.Text = conflicts.ServerConflict.LocalSize; serverName.Text = conflicts.ServerConflict.ServerName; serverDate.Text = conflicts.ServerConflict.ServerDate; serverSize.Text = conflicts.ServerConflict.ServerSize; saveLocal.Enabled = !readOnly; saveServer.Enabled = true; } else { serverPanel.Visible = localPanel.Visible = false; nameConflict.Visible = true; if (conflicts.LocalConflict != null) { newName.Text = conflicts.LocalConflict.LocalName; } else if (readOnly) { string localFile = Path.Combine(ifolder.UnManagedPath, conflicts.ServerConflict.ServerName); if (File.Exists(localFile)) { conflicts.LocalConflict = new Conflict(); newName.Text = conflicts.LocalConflict.LocalName = conflicts.ServerConflict.ServerName; conflicts.LocalConflict.LocalFullPath = Path.Combine(ifolder.UnManagedPath, conflicts.LocalConflict.LocalName); } else { resolveName.Enabled = false; } } else { newName.Text = conflicts.ServerConflict.ServerName; } } } else { serverPanel.Visible = localPanel.Visible = false; nameConflict.Visible = true; resolveNameLabel.Text = resourceManager.GetString("multiNameConflict"); newName.Enabled = resolveName.Enabled = false; foreach (ListViewItem lvi in conflictsView.SelectedItems) { if (((Conflicts)lvi.Tag).ServerConflict != null) if (!((Conflicts)lvi.Tag).ServerConflict.IsNameConflict) { serverPanel.Visible = localPanel.Visible = true; nameConflict.Visible = false; break; } } conflicts = null; localName.Text = serverName.Text = resourceManager.GetString("multiSelect"); localDate.Text = serverDate.Text = localSize.Text = serverSize.Text = ""; saveLocal.Enabled = !readOnly; saveServer.Enabled = true; } }
protected void ConflictResolver_Load(object sender, System.EventArgs e) { string helpFile = Path.Combine(Path.Combine(Path.Combine(loadPath, "help"), iFolderAdvanced.GetLanguageDirectory()), @"conflicts.html"); if (!File.Exists(helpFile)) { helpFile = Path.Combine(loadPath, @"help\en\conflicts.html"); } if (File.Exists(helpFile)) { helpProvider1.HelpNamespace = helpFile; } try { string basePath = loadPath != null ? Path.Combine(loadPath, "res") : Path.Combine(Application.StartupPath, "res"); this.Icon = new Icon(Path.Combine(basePath, "ifolder-conflict22.ico")); } catch { } try { ifolderName.Text = ifolder.Name; Conflict[] conflictArray = ifWebService.GetiFolderConflicts(ifolder.ID); foreach (Conflict conflict in conflictArray) { Conflicts conflicts = new Conflicts(); ListViewItem lvi = null; if (!conflict.IsNameConflict) { string[] items = new string[3]; items[0] = conflict.LocalName; items[1] = Path.GetDirectoryName(conflict.LocalFullPath).Substring(ifolder.UnManagedPath.Length); items[2] = resourceManager.GetString("file"); lvi = new ListViewItem(items); conflicts.ServerConflict = conflict; } else { if (conflict.LocalName != null) { string[] items = new string[3]; items[0] = conflict.LocalName; items[1] = Path.GetDirectoryName(conflict.LocalFullPath).Substring(ifolder.UnManagedPath.Length); items[2] = resourceManager.GetString("name"); conflicts.LocalConflict = conflict; lvi = new ListViewItem(items); } else { conflicts.ServerConflict = conflict; } } if (lvi != null) { lvi.Tag = conflicts; conflictsView.Items.Add(lvi); } } foreach (Conflict conflict in conflictArray) { if (conflict.IsNameConflict && (conflict.ServerFullPath != null)) { foreach (ListViewItem lvi in conflictsView.Items) { Conflicts conflicts = (Conflicts)lvi.Tag; if (conflicts.LocalConflict == null) continue; if (lvi.Text.Equals(conflict.ServerName) && conflicts.LocalConflict.LocalFullPath.Equals(conflict.ServerFullPath)) { ((Conflicts)lvi.Tag).ServerConflict = conflict; break; } } } } } catch (Exception ex) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("conflictReadError"), string.Empty, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } readOnly = ifolder.CurrentUserRights.Equals("ReadOnly"); if (readOnly) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("readOnlyInfo"), resourceManager.GetString("readOnlyTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Information); mmb.ShowDialog(); } }