private void OkButton_Click(object sender, EventArgs e) { SettableAttributes att = new SettableAttributes (readOnlyChBox.Checked, hiddenChBox.Checked, archiveChBox.Checked); OnOkClicked(att); Close(); }
public PropertyForm(string elementName, RequestSizeDataHandler onSizeRequested, TerminationHandler onCalculationTerminated, SettableAttributes attributes, AttributeHandler onOkClicked) { RequestSizeData = onSizeRequested; TerminateCalculation = onCalculationTerminated; Init(elementName, 0, 0, attributes, onOkClicked); timer1.Start(); }
private void OnAttributeResponse(SettableAttributes attributes) { foreach (FileSystemInfo info in SentSources) { string path = info.FullName; RemoveSettableAttributes(path); if (attributes.IsReadOnly) { File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.ReadOnly); } if (attributes.IsHidden) { File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); } if (attributes.IsArchive) { File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Archive); } } }
private void Init(string elementName, int elements, long size, SettableAttributes attributes, AttributeHandler onOkClicked) { InitializeComponent(); nameTextBox.Text = elementName; sizeTextBox.Text = size.ToString(); elementsTextBox.Text = elements.ToString(); if (attributes.IsReadOnly) { readOnlyChBox.Checked = true; } if (attributes.IsHidden) { hiddenChBox.Checked = true; } if (attributes.IsArchive) { archiveChBox.Checked = true; } OnOkClicked = onOkClicked; Show(); }
public void ViewProperty(ICollection <FileSystemInfo> infos) { FileSystemInfo info = infos.ElementAt(0); SettableAttributes attrs = GetSettableAttributes(infos); SentSources = infos; DirSizeCalculator calc = new DirSizeCalculator(); string name; if (infos.Count > 1) { name = "<multiple selected>"; } else { name = infos.ElementAt(0).Name; } PropertyForm pr = new PropertyForm (name, calc.RequestData, calc.Terminate, attrs, OnAttributeResponse); calc.Calculate(infos); }
public PropertyForm(string elementName, int elements, long size, SettableAttributes attributes, AttributeHandler onOkClicked) { Init(elementName, elements, size, attributes, onOkClicked); }