本文整理汇总了C#中PopupDialog类的典型用法代码示例。如果您正苦于以下问题:C# PopupDialog类的具体用法?C# PopupDialog怎么用?C# PopupDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PopupDialog类属于命名空间,在下文中一共展示了PopupDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Open
public void Open ()
{
if (!hasInit) {
Init ();
hasInit = true;
}
if (!Visible) {
if (Skin == null)
Skin = HighLogic.UISkin;
Visible = true;
Opened ();
EventHandlerExtensions.Invoke (OnOpen, this);
dialog = new MultiOptionDialog (Message, Title, Skin, Options.ToArray ());
popup = PopupDialog.SpawnPopupDialog (new Vector2 (0.5f, 0.5f), new Vector2 (0.5f, 0.5f), dialog, true, HighLogic.UISkin);
}
}
示例2: LaunchButton
void LaunchButton()
{
List<DialogOption> LaunchOptionsList = new List<DialogOption>();
LaunchOptionsList.Add(new DialogOption("Proceed to Launch", InvokeLaunch));
LaunchOptionsList.Add( new DialogOption("Simulate this Vessel", InvokeSimulation));
LaunchOptionsList.Add(new DialogOption("Cancel Launch", null));
// This is how you hide tooltips.
EditorTooltip.Instance.HideToolTip();
GameEvents.onTooltipDestroyRequested.Fire();
// Lock inputs
EditorLogic.fetch.Lock(true, true, true, "KCT_EDITOR_LAUNCH_A");
InputLockManager.SetControlLock(ControlTypes.EDITOR_SOFT_LOCK, "KCT_EDITOR_LAUNCH_B");
// Display the new launch prompt
LaunchDialog = PopupDialog.SpawnPopupDialog(new MultiOptionDialog(null, null, Skin, LaunchOptionsList.ToArray()), false, Skin);
}
示例3: DeleteButtonHandler
private void DeleteButtonHandler(object parameter)
{
if (SelectedComponent != null)
{
string message = string.Format("Remove selected Calibration? ({0})", SelectedComponent.Name);
PopupDialog popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message);
popupDialog.Show();
popupDialog.Closed +=
(s2, e2) =>
{
if (popupDialog.PopupDialogResult == PopupDialogResult.Yes)
{
mInstrument.CalibrationComponents.Remove(SelectedComponent);
View.ComponentPropertiesControl.Content = null;
RaisePropertyChanged("Components");
RaisePropertyChanged("SelectedComponent");
mSelectedComponent = null;
RaiseChangeEvent();
OnCollectionChanged();
}
};
}
}
示例4: RemoveIssue
private void RemoveIssue(QuickIssue quickIssue)
{
if (!CMS.EffectivePrivileges.IssueTab.CanDelete || !CMS.EffectivePrivileges.AdminTab.CanModify || !quickIssue.IsActive)
{
return;
}
string message = String.Format("Delete Issue {0} - '{1}' Issue?", quickIssue.Id, quickIssue.Name);
var popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message);
popupDialog.Show();
popupDialog.Closed +=
(s2, e2) =>
{
if (popupDialog.PopupDialogResult == PopupDialogResult.Yes)
{
//DELETE
var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
cmsWebServiceClient.DeleteIssueCompleted +=
(s1, e1) =>
{
EventAggregator.GetEvent<PrismEvents.CloseTabPrismEvent>().Publish(quickIssue);
};
cmsWebServiceClient.DeleteIssueAsync(quickIssue.Id, CMS.User.Id);
}
};
}
示例5: UnMarkIssueAsRestrictedContent
private void UnMarkIssueAsRestrictedContent(QuickIssue quickIssue)
{
var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
cmsWebServiceClient.UnMarkIssueAsRestrictedCompleted += (s, e) =>
{
if (e.Result)
{
quickIssue.RestrictedContent = false;
}
else
{
var dialog = new PopupDialog(PopupDialogType.Error,
"Access is restricted due to issue content – please contact the System Administrator.",
"Restricted Content Issue");
dialog.Show();
}
};
cmsWebServiceClient.UnMarkIssueAsRestrictedAsync(quickIssue.Id, CMS.User.Id);
}
示例6: OkButtonHandler
private void OkButtonHandler(object parameter)
{
if (CanExecuteAddButtonHandler(parameter))
{
if (AreAllValid() && PurchaseOrders.All(x => !x.HasErrors) && OtherAccruals.All(x => !x.HasErrors))
{
var undeliveredPortionHigherThanAccrue = PurchaseOrders.Where(x => x.UndeliveredPortion.HasValue && x.AmountAccruedDecimal > x.UndeliveredPortion.Value).ToList();
if (undeliveredPortionHigherThanAccrue.Any())
{
StringBuilder errorMessage = new StringBuilder();
foreach (var purchaseOrderAccureModel in undeliveredPortionHigherThanAccrue)
{
errorMessage.Append(String.Format("Accrue {0:c} is more than Undelivered Proportion {1:c}.{2}", purchaseOrderAccureModel.AmountAccruedDecimal,
purchaseOrderAccureModel.UndeliveredPortion.Value, Environment.NewLine));
}
errorMessage.Append(Environment.NewLine);
errorMessage.Append("Click OK to accept or Cancel to modify.");
PopupDialog popupDialog = new PopupDialog(PopupDialogType.SaveComfirm, errorMessage.ToString(), "Warning", 700, 250);
popupDialog.Show();
popupDialog.Closed += (sender, args) =>
{
if (popupDialog.PopupDialogResult == PopupDialogResult.Ok)
{
Save();
}
else
{
foreach (var purchaseOrderAccureModel in undeliveredPortionHigherThanAccrue)
{
purchaseOrderAccureModel.AddValidationError("Accrue", "Accrue is more than the Undelivered amount");
}
}
};
}
else
{
Save();
}
}
else
{
var validationErrors = GetErrors();
if (validationErrors.Any())
{
View.ValidationPopup.Show(validationErrors);
}
}
}
}
示例7: ProccessTransferFiles
private void ProccessTransferFiles(int fileNumber, FileInfo dialogFile, List<FileInfo> dialogFiles)
{
var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
try
{
Stream stream = dialogFile.OpenRead();
View.RadProgressBar1.Maximum = stream.Length;
View.RadProgressBar1.Minimum = 0;
View.RadProgressBar1.Visibility = Visibility.Visible;
View.RadProgressBar1.Value = 0;
if (stream.Length > int.MaxValue)
{
var errorDialog = new PopupDialog(PopupDialogType.Warning, string.Format("File [{0}] can not be bigger than 2GB.", dialogFile.Name), "Warning: File is to large");
errorDialog.Show();
return;
}
int transferChunkSize = Utils.GetTransferChunkSize(stream);
var file = new CommonUploadFile {Name = dialogFile.Name, Size = stream.Length, Path = Guid.NewGuid().ToString()};
var newAttachment = new IssueFile
{
DateUploaded = DateTime.Now,
Filename = file.Name,
IssueId = mIssue.Id,
Issue = mIssue,
Path = file.Path,
UploadedById = CMS.User.Id,
User = CMS.User,
AttachmentType = new AttachmentType {Id = (int) CommonUtils.AttachmentType.Unknown},
AttachmentTypeId = (int) CommonUtils.AttachmentType.Unknown,
AttachmentTypes = mAttachmentTypes,
RestrictedContent = false,
SelectedAttachmentType = new AttachmentType {Id = (int) CommonUtils.AttachmentType.Unknown}
};
file.Attachment = newAttachment;
if (stream.Position > -1 && stream.Position < stream.Length)
{
int chunkSize = Utils.GetCurrentChunkSize(stream, transferChunkSize);
var fileBytes = new byte[chunkSize];
stream.Read(fileBytes, 0, chunkSize);
EventHandler<UploadAttachmentCompletedEventArgs> uploadFileChunkCompleted = null;
uploadFileChunkCompleted = (s1, e1) =>
{
if (stream.Position > -1 && stream.Position < stream.Length)
{
chunkSize = Utils.GetCurrentChunkSize(stream, transferChunkSize);
double percentage = (stream.Position/file.Size);
string fileName = file.Attachment.Filename.Remove(0, file.Attachment.Filename.IndexOf(']') + 1).Trim();
file.Attachment.Filename = String.Format("[{0:#.##%}] {1}", percentage, fileName);
fileBytes = new byte[chunkSize];
stream.Read(fileBytes, 0, chunkSize);
View.RadProgressBar1.Value = View.RadProgressBar1.Value + chunkSize;
cmsWebServiceClient.UploadAttachmentAsync(file.Name, fileBytes, file.Path, true);
}
else
{
file.Attachment.Filename = file.Name;
cmsWebServiceClient.UploadAttachmentCompleted -= uploadFileChunkCompleted;
Attachments.Add(newAttachment);
//Close the stream when all files are uploaded
stream.Close();
UploadInProgress = false;
if (dialogFiles.Count > fileNumber + 1)
{
fileNumber++;
ProccessTransferFiles(fileNumber, dialogFiles[fileNumber], dialogFiles);
}
mIssue.IssueFiles.Add(newAttachment);
RaisePropertyChanged("SelectedAttachmentType");
RaisePropertyChanged("Attachments");
OnCollectionChanged();
//UPLOAD IS COMPLETE - Save Model
cmsWebServiceClient.SaveIssueFilesCompleted += ((sender, args) =>
{
EventAggregator.GetEvent<PrismEvents.RefreshIssueRevisionHistoryPrismEvent>().Publish(null);
});
cmsWebServiceClient.SaveIssueFilesAsync(new List<IssueFile> {newAttachment});
View.RadProgressBar1.Visibility = Visibility.Collapsed;
OnUploadComplete();
}
};
//.........这里部分代码省略.........
示例8: AddExistingControlSystemComponentTypeAlarmProperty
private void AddExistingControlSystemComponentTypeAlarmProperty(NodeView nodeView)
{
var controlSystemEquipmentComponentTypeId = nodeView.Parent.Id;
var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
cmsWebServiceClient.GetControlSystemComponentTypeCompleted +=
(s, e) =>
{
var dialog = new AddEditExistingControlSystemComponentAlarmPropertyDialog(e.Result);
dialog.Show();
dialog.Closed += (s1, e1) =>
{
if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
{
EventHandler<SaveControlSystemComponentTypeAlarmPropertyCompletedEventArgs> addCompleted = null;
addCompleted = (s2, eventArgs) =>
{
var entityResult = eventArgs.Result.EntityResult;
if (eventArgs.Result.HasErrors)
{
var popup = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(eventArgs.Result.ServerErrorMessages));
popup.Show();
return;
}
if (entityResult != null)
{
var child = new NodeView(nodeView)
{
Id = entityResult.Id,
Name = dialog.ControlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Name,
Description = dialog.ControlSystemComponentTypeAlarmProperty.ControlSystemAlarmProperty.Description,
Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
Type = NodeType.ControlSystemComponentTypeAlarmProperty,
HasChildren = false,
SortField = entityResult.Ordinal.ToString()
};
if (nodeView.ChildrenLoaded)
{
nodeView.Children.Add(child);
nodeView.Sort();
}
}
cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyCompleted -= addCompleted;
};
cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyCompleted += addCompleted;
var systemComponentTypeTuningProperty = new ControlSystemComponentTypeAlarmProperty
{
ComponentTypeId = controlSystemEquipmentComponentTypeId,
AlarmPropertyId = dialog.ControlSystemComponentTypeAlarmProperty.AlarmPropertyId,
Ordinal = dialog.ControlSystemComponentTypeAlarmProperty.Ordinal
};
cmsWebServiceClient.SaveControlSystemComponentTypeAlarmPropertyAsync(systemComponentTypeTuningProperty);
}
};
};
cmsWebServiceClient.GetControlSystemComponentTypeAsync(controlSystemEquipmentComponentTypeId);
}
示例9: DeleteButtonHandler
private void DeleteButtonHandler(object parameter)
{
var selected = (from x in DocumentLocations where x.Checked select x).ToList();
if (selected.Count == 0)
{
return;
}
string message = string.Format("Remove selected Locations? ({0})", selected.Count);
PopupDialog popupDialog = new PopupDialog(PopupDialogType.ConfirmDelete, message);
popupDialog.Show();
popupDialog.Closed +=
(s2, e2) =>
{
if (popupDialog.PopupDialogResult == PopupDialogResult.Yes)
{
List<DocumentAssignedLocation> keep = new List<DocumentAssignedLocation>((from x in DocumentLocations where !x.Checked select x).ToList());
mDocument.DocumentAssignedLocations = keep;
RaisePropertyChanged("DocumentLocations");
OnCollectionChanged();
Utils.OnCollectionChanged(EventAggregator, mDocument, "DocumentLocationsViewModel", true);
}
};
}
示例10: Save
private void Save(TimesheetDialog view)
{
if (!HasErrors())
{
mTimesheet.LastModifiedByUserId = CMS.User.Id;
mTimesheet.LastModifiedDate = DateTime.Now;
mSavingTimesheet = true;
OkButtonCommand.RaiseCanExecuteChanged();
SubmitButtonCommand.RaiseCanExecuteChanged();
var cee = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
cee.SaveTimesheetCompleted += (s, e) =>
{
if (e.Result.HasErrors)
{
var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e.Result.ServerErrorMessages));
errorDialog.Show();
mSavingTimesheet = false;
OkButtonCommand.RaiseCanExecuteChanged();
SubmitButtonCommand.RaiseCanExecuteChanged();
}
else
{
view.Timesheet = mTimesheet;
view.DialogResult = true;
}
};
cee.SaveTimesheetAsync(mTimesheet);
}
}
示例11: Reinstate
private void Reinstate(QuickDocument quickDocument)
{
var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
cmsWebServiceClient.UnDeleteDocumentCompleted += (s, e) =>
{
if (e.Result.HasErrors)
{
var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(e.Result.ServerErrorMessages));
errorDialog.Show();
return;
}
};
cmsWebServiceClient.UnDeleteDocumentAsync(quickDocument.Id);
}
示例12: CheckForTooManyFavourites
private void CheckForTooManyFavourites()
{
//if we try and save too many at once silverlight throws an "too large" exception. set the max using the const. 150 should be enough.
if (mFilteredQuickDocuments.Count > MaxFav)
{
var errors = new List<string> { string.Format("Added the first {0} items of {1} to Favourites. This is the maximum that can be saved at once.", MaxFav, mFilteredQuickDocuments.Count) };
var errorDialog = new PopupDialog(PopupDialogType.Information, Utils.DisplayErrorMessages(errors));
errorDialog.Show();
}
}
示例13: ShowDialogMessage
public ShowDialogMessage(object source, PopupDialog type, bool moduleDialog)
: this(type, (object)null)
{
Source = source;
ModuleDialog = moduleDialog;
}
示例14: RemoveControlSystemComponentTypeAlarmProperty
private void RemoveControlSystemComponentTypeAlarmProperty(NodeView nodeView)
{
var confirmDialog = new PopupDialog(PopupDialogType.ConfirmDelete, string.Format("Delete property '{0}'?", nodeView.Name));
confirmDialog.Show();
confirmDialog.Closed +=
(s, e) =>
{
if (confirmDialog.PopupDialogResult == PopupDialogResult.Yes)
{
var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
EventHandler<DeleteControlSystemComponentTypeAlarmPropertyCompletedEventArgs> deleteCompleted = null;
deleteCompleted = (s2, eventArgs) =>
{
if (!eventArgs.Result.HasErrors)
{
nodeView.Parent.Children.Remove(nodeView);
}
else
{
var errorDialog = new PopupDialog(PopupDialogType.Error, Utils.DisplayErrorMessages(eventArgs.Result.ServerErrorMessages));
errorDialog.Show();
}
cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyCompleted -= deleteCompleted;
};
cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyCompleted += deleteCompleted;
cmsWebServiceClient.DeleteControlSystemComponentTypeAlarmPropertyAsync(nodeView.Id);
}
};
}
示例15: RemoveInterlockTypeProperty
private void RemoveInterlockTypeProperty(NodeView nodeView)
{
var confirmDialog = new PopupDialog(PopupDialogType.ConfirmDelete, string.Format("Delete property '{0}'?", nodeView.Name));
confirmDialog.Show();
confirmDialog.Closed +=
(s, e) =>
{
if (confirmDialog.PopupDialogResult == PopupDialogResult.Yes)
{
var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
EventHandler<RemoveInterlockTypePropertyCompletedEventArgs> deleteCompleted = null;
deleteCompleted = (s2, eventArgs) =>
{
var error = eventArgs.Result;
if (string.IsNullOrEmpty(error))
{
nodeView.Parent.Children.Remove(nodeView);
}
else
{
var errorDialog = new PopupDialog(PopupDialogType.Error, error);
errorDialog.Show();
}
cmsWebServiceClient.RemoveInterlockTypePropertyCompleted -= deleteCompleted;
};
cmsWebServiceClient.RemoveInterlockTypePropertyCompleted += deleteCompleted;
cmsWebServiceClient.RemoveInterlockTypePropertyAsync(nodeView.Id);
}
};
}