public void InitFrom(Model.GlobalExcludeFiltersDataTable excludes) { TableModel.Rows.Clear(); foreach (Model.GlobalExcludeFiltersRow row in excludes) { VisualizeFilter(row.Mask, row.Info, false); } }
private void SaveTo(Model.FoldersRow folder) { tableIncludes.SaveToIncludes(folder); tableExcludes.SaveToExcludes(folder); if (editGlobalIncludes) tableIncludes.SaveToGlobalIncludes(model); if (editGlobalExcludes) tableExcludes.SaveToGlobalExcludes(model); }
public ProjectFilters(Model model, Model.FoldersRow folder) { this.model = model; this.folder = folder; // this must go after InitFrom ! Model.SettingsRow settings = model.GetSettings(); this.tableIncludes = new XRefresh.FilterTable(settings.ShowGlobalIncludes, false); this.tableExcludes = new XRefresh.FilterTable(settings.ShowGlobalExcludes, false); ((System.ComponentModel.ISupportInitialize)(this.tableIncludes)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tableExcludes)).BeginInit(); InitializeComponent(); // // tableIncludes // this.tableIncludes.AllowDrop = true; this.tableIncludes.AlternatingRowColor = System.Drawing.Color.WhiteSmoke; this.tableIncludes.CustomEditKey = System.Windows.Forms.Keys.Return; this.tableIncludes.Dock = System.Windows.Forms.DockStyle.Fill; this.tableIncludes.EnableHeaderContextMenu = false; this.tableIncludes.ForeColor = System.Drawing.Color.Black; this.tableIncludes.FullRowSelect = true; this.tableIncludes.GridLines = XPTable.Models.GridLines.Both; this.tableIncludes.GridLineStyle = XPTable.Models.GridLineStyle.Dot; this.tableIncludes.Location = new System.Drawing.Point(349, 25); this.tableIncludes.Name = "tableIncludes"; this.tableIncludes.NoItemsText = "There are no file filters. Drag and drop a file here ..."; this.tableIncludes.SelectionBackColor = System.Drawing.Color.Yellow; this.tableIncludes.SelectionForeColor = System.Drawing.Color.Black; this.tableIncludes.Size = new System.Drawing.Size(340, 140); this.tableIncludes.TabIndex = 0; this.tableIncludes.Text = "tableIncludes"; // // tableExcludes // this.tableExcludes.AllowDrop = true; this.tableExcludes.AlternatingRowColor = System.Drawing.Color.WhiteSmoke; this.tableExcludes.CustomEditKey = System.Windows.Forms.Keys.Return; this.tableExcludes.Dock = System.Windows.Forms.DockStyle.Fill; this.tableExcludes.EnableHeaderContextMenu = false; this.tableExcludes.ForeColor = System.Drawing.Color.Black; this.tableExcludes.FullRowSelect = true; this.tableExcludes.GridLines = XPTable.Models.GridLines.Both; this.tableExcludes.GridLineStyle = XPTable.Models.GridLineStyle.Dot; this.tableExcludes.Location = new System.Drawing.Point(3, 25); this.tableExcludes.Name = "tableExcludes"; this.tableExcludes.NoItemsText = "There are no file filters. Drag and drop a file here ..."; this.tableExcludes.SelectionBackColor = System.Drawing.Color.Yellow; this.tableExcludes.SelectionForeColor = System.Drawing.Color.Black; this.tableExcludes.Size = new System.Drawing.Size(340, 140); this.tableExcludes.TabIndex = 3; this.tableExcludes.Text = "table2"; ((System.ComponentModel.ISupportInitialize)(this.tableIncludes)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tableExcludes)).EndInit(); this.tableLayoutPanel.Controls.Add(this.tableIncludes, 1, 1); this.tableLayoutPanel.Controls.Add(this.tableExcludes, 0, 1); HideDebugger(); this.Text = folder.Name + " Filters Designer"; editGlobalIncludes = checkBoxGlobalIncludes.Checked = settings.ShowGlobalIncludes; editGlobalExcludes = checkBoxGlobalExcludes.Checked = settings.ShowGlobalExcludes; this.checkBoxGlobalIncludes.CheckedChanged += new System.EventHandler(this.checkBoxGlobalIncludes_CheckedChanged); this.checkBoxGlobalExcludes.CheckedChanged += new System.EventHandler(this.checkBoxGlobalExcludes_CheckedChanged); InitFrom(folder); editTestPath.Text = folder.Path; tableIncludes.Changed += new FilterTable.ChangedHandler(tableIncludes_Changed); tableExcludes.Changed += new FilterTable.ChangedHandler(tableExcludes_Changed); }
private void InitFrom(Model.FoldersRow folder) { tableIncludes.InitFrom(folder.GetIncludeFiltersRows(), editGlobalIncludes ? model.GlobalIncludeFilters : null); tableExcludes.InitFrom(folder.GetExcludeFiltersRows(), editGlobalExcludes ? model.GlobalExcludeFilters : null); }
public void InitFrom(Model.IncludeFiltersRow[] includes, Model.GlobalIncludeFiltersDataTable gincludes) { TableModel.Rows.Clear(); if (gincludes!=null) { foreach (Model.GlobalIncludeFiltersRow row in gincludes) { VisualizeFilter(row.Mask, row.Info, false); } } foreach (Model.IncludeFiltersRow row in includes) { VisualizeFilter(row.Mask, row.Info, true); } }
internal void SaveToGlobalIncludes(Model model) { model.GlobalIncludeFilters.Clear(); foreach (Row row in TableModel.Rows) { if (row.Cells[0].Checked && row.Cells[0].Text.Length > 0) { if (row.Cells[1].ForeColor == Color.Gray) model.GlobalIncludeFilters.AddGlobalIncludeFiltersRow(row.Cells[0].Text, null); else model.GlobalIncludeFilters.AddGlobalIncludeFiltersRow(row.Cells[0].Text, row.Cells[1].Text); } } }
internal void SaveToIncludes(Model.FoldersRow folder) { folder.ClearIncludes(); Model model = folder.Table.DataSet as Model; foreach (Row row in TableModel.Rows) { if (!row.Cells[0].Checked && row.Cells[0].Text.Length>0) { if (row.Cells[1].ForeColor == Color.Gray) model.IncludeFilters.AddIncludeFiltersRow(row.Cells[0].Text, null, folder); else model.IncludeFilters.AddIncludeFiltersRow(row.Cells[0].Text, row.Cells[1].Text, folder); } } }
public File(string root, Model.Activity activity) { action = activity.type.ToString().ToLower(); path1 = RelativePath(activity.path1, root); path2 = RelativePath(activity.path2, root); }
public ServerMessageRefresh(Model.FoldersRow folder, bool positive) : base("DoRefresh") { lock (folder.activities) { DateTime d = DateTime.Now; date = d.ToShortDateString(); time = d.ToLongTimeString(); root = folder.Path; name = folder.Name; // <path, most significant activity> Dictionary<string, Model.Activity> ops = new Dictionary<string, Model.Activity>(); while (folder.activities.Count > 0) { Model.Activity activity = folder.activities.Dequeue(); string sourcePath = activity.path1; string destPath = activity.type == Model.ActivityType.Renamed ? activity.path2 : activity.path1; // here is quite difficult logic to explain // I try to track and accumulate file change events and keep most significant information about what happened to files // // for example Microsoft Visual Studio 200 does this during file save (CTRL+S): // 1) saves file into temporary file (I get 'created' event and possibly many 'changed' events) // 2) deletes old file // 3) renames temporary file to the original name (location) // I need here to track renames and keep up-to-date location // I also keep most significant event: (deleted|created)>renamed>changed // if there was delete and create in row, I then change the event type to 'Changed' Model.Activity lastActivity = null; if (ops.ContainsKey(sourcePath)) lastActivity = ops[sourcePath]; if (ops.ContainsKey(destPath)) lastActivity = ops[destPath]; if (lastActivity!=null) { // nonsense of modifying deleted file ? stay on deleted message if (lastActivity.type == Model.ActivityType.Deleted && activity.type == Model.ActivityType.Changed) activity = lastActivity; // some apps may delete file and then recreate it, instead of changing it's content if (lastActivity.type == Model.ActivityType.Deleted && (activity.type == Model.ActivityType.Renamed || activity.type == Model.ActivityType.Created)) { activity.type = Model.ActivityType.Changed; activity.path1 = destPath; activity.path2 = ""; } // creation is more significant than modification and renaming if (lastActivity.type == Model.ActivityType.Created && (activity.type == Model.ActivityType.Renamed || activity.type == Model.ActivityType.Changed)) activity = lastActivity; // renaming is more significant to modification if (lastActivity.type == Model.ActivityType.Renamed && activity.type == Model.ActivityType.Changed) activity = lastActivity; // purge last activity activity.passed = activity.passed || lastActivity.passed; if (ops.ContainsKey(sourcePath)) ops.Remove(sourcePath); if (ops.ContainsKey(destPath)) ops.Remove(destPath); } // store new activity ops.Add(destPath, activity); } int passedCount = 0; foreach (Model.Activity activity in ops.Values) { if (activity.passed) passedCount++; } files = new File[passedCount]; int i = 0; foreach (Model.Activity activity in ops.Values) { if (activity.passed) { files[i] = new File(root, activity); i++; } } } }
private Model model; // temporary model copy for configuration form #endregion Fields #region Constructors public AdvancedSettings(Model model) { this.model = model; InitializeComponent(); firefoxDialog.ResetEvent += new GUI.FirefoxDialog.FirefoxDialog.ResetEventHandler(firefoxDialog_ResetEvent); }
public PageNetwork(Model model) { this.model = model; InitializeComponent(); }
public PageMain(Model model) { this.model = model; InitializeComponent(); }