public FileConflictResolution ResolveFileConflict(string message) { if (_overwriteAll) { return(FileConflictResolution.OverwriteAll); } if (_ignoreAll) { return(FileConflictResolution.IgnoreAll); } FileConflictResolution resolution = Helpers.DispatchInvokeIfNecessary(() => { var window = new FileConflictDialog { Message = message }; bool?result = _host.ShowDialog(null, window); return((result == null || result == false) ? FileConflictResolution.Ignore : window.UserSelection); }); _overwriteAll = (resolution == FileConflictResolution.OverwriteAll); _ignoreAll = (resolution == FileConflictResolution.IgnoreAll); return(resolution); }
/// <summary> /// get the current version of the app /// </summary> /// <param name="parameter">Unused.</param> private void HandleGetVersion(object parameter) { var request = HttpWebRequest.Create(_webMatrixHost.DefaultWebSitePath + "/GetProductInformation.ashx"); var response = request.GetResponse(); XmlDocument r = new XmlDocument(); r.Load(response.GetResponseStream()); var version = r.ChildNodes[2].ChildNodes[1]; _webMatrixHost.ShowDialog("NumediaStack Version", "Version " + version, DialogSize.Small, MessageBoxButton.OK); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected void AddOptions(ContextMenuOpeningEventArgs e) { // we only show the context menu if every item selected in the tree is valid to be compiled var jobs = new List <OrangeJob>(); var showMenu = e.Items.Count > 0; Type itemType = null; // determine if we're dealing with folders or files. If it's mixed, bug out foreach (ISiteItem item in e.Items) { if (itemType == null) { itemType = item.GetType(); } else if (itemType != item.GetType()) { return; } } var menuItem = new ContextMenuItem("OrangeBits Options", null, new DelegateCommand((items) => { var selectedItems = items as IEnumerable <ISiteItem>; var dialog = new OptionsUI(); var vm = new OptionViewModel() { Paths = selectedItems.Select(x => (x as ISiteFileSystemItem).Path).ToArray() }; prefUtility.LoadOptions(vm); dialog.DataContext = vm; var result = _host.ShowDialog("OrangeBits Options", dialog); if (result.HasValue && result.Value) { prefUtility.SaveOptions(vm); } }), e.Items); e.AddMenuItem(menuItem); }