本文整理汇总了C#中System.Windows.Controls.ChildWindow类的典型用法代码示例。如果您正苦于以下问题:C# ChildWindow类的具体用法?C# ChildWindow怎么用?C# ChildWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChildWindow类属于System.Windows.Controls命名空间,在下文中一共展示了ChildWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModifyPasswordWindowViewModel
public ModifyPasswordWindowViewModel(ChildWindow aChileWindow)
{
this.ChildWindow = aChileWindow;
ModifyPasswordEntity = new ModifyPasswordEntity();
OnModifyPassword = new DelegateCommand(OnModifyPasswordCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
}
示例2: ShowWindow
/// <summary>
/// Displays content in a window
/// </summary>
/// <param name="windowTitle">Title text shown in window</param>
/// <param name="windowContents">Contents of the window</param>
/// <param name="isModal">Determines wheter the window is modal or not</param>
/// <param name="onClosingHandler">Event handler invoked when window is closing, and can be handled to cancel window closure</param>
/// <param name="onClosedHandler">Event handler invoked when window is closed</param>
public void ShowWindow(string windowTitle, FrameworkElement windowContents, bool isModal = false, EventHandler<CancelEventArgs> onClosingHandler = null, EventHandler onClosedHandler = null)
{
if (windowContents == null)
throw new ArgumentNullException("windowContents");
int hashCode = windowContents.GetHashCode();
ChildWindow childWindow = null;
if (!m_ChildWindows.TryGetValue(hashCode, out childWindow))
{
// not existing yet
childWindow = new ChildWindow()
{
Title = windowTitle ?? string.Empty,
};
if (onClosedHandler != null)
childWindow.Closed += onClosedHandler;
if (onClosingHandler != null)
childWindow.Closing += onClosingHandler;
childWindow.CloseCompleted += new EventHandler(childWindow_CloseCompleted);
childWindow.Content = windowContents;
m_ChildWindows.Add(hashCode, childWindow);
if (!isModal)
{
windowContents.Loaded += (o, e) => {
DialogResizeHelper.CenterAndSizeDialog(windowContents, childWindow);
};
DialogResizeHelper.CenterAndSizeDialog(windowContents, childWindow);
}
}
childWindow.ShowDialog(isModal);
}
示例3: addOrder_Click_1
private void addOrder_Click_1(object sender, RoutedEventArgs e)
{
try
{
ChildWindow addWin = new ChildWindow();
AddOrdreUC addOrdUC = new AddOrdreUC();
addOrdUC.ParentWin = addWin;
addWin.forUC.Children.Add(addOrdUC);
addWin.SizeToContent = SizeToContent.WidthAndHeight;
addWin.Title = "Add Order";
bool? dialogRes = addWin.ShowDialog();
if (dialogRes.HasValue && dialogRes.Value)
{
if (orderManager.AddOrder(addOrdUC.CustomerId, addOrdUC.Time, addOrdUC.Cost, addOrdUC.Status, addOrdUC.OrderType))
{
MessageBox.Show("Sucsses");
orderCatalogViewModel.ResetCatalog();
this.dgCatalogUC.DataContext = orderCatalogViewModel.Catalog;
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例4: FileTypeWindowViewModel
public FileTypeWindowViewModel(ChildWindow aChildWindow, FileTypeEntity aFileTypeEntity)
{
childWindow = aChildWindow;
FileTypeEntity = aFileTypeEntity;
OnOK = new DelegateCommand(OnOKCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
}
示例5: UserEntityViewModule
public UserEntityViewModule(ChildWindow aChileWindow, UserEntityViewType aUserEntityViewType, UserEntity aUserEntity, ObservableCollection<DepartmentEntity> aDepartmentEntity)
{
this.UserEntityVIewType = aUserEntityViewType;
this.childWindow = aChileWindow;
this.UserEntity = aUserEntity;
this.DepartmentList = aDepartmentEntity;
if(String.IsNullOrEmpty(aUserEntity.UserName))
{
Title = "添加用户";
}
else
{
Title = "修改用户 编号:" + aUserEntity.UserID.ToString();
}
OnOK = new DelegateCommand(OnOKCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
OnClose = new DelegateCommand(OnCloseCommand);
if (aUserEntityViewType == UserEntityViewType.ADD)
{
IsAdd = true;
}
else
{
IsAdd = false;
}
CompositionInitializer.SatisfyImports(this);
}
示例6: ShowControlInWindow
/// <summary>
/// Shows a control in a window.
/// </summary>
/// <param name="control">Control to show in a window.</param>
public static void ShowControlInWindow(UIElement control)
{
#if SILVERLIGHT
// Create window
ChildWindow window = new ChildWindow();
// Set as window content
window.Content = control;
#else
// Create window
Window window = new Window();
// Create a stack panel
StackPanel stackPanel = new StackPanel();
stackPanel.Children.Add(control);
// Set as window content
window.Content = stackPanel;
#endif
// Set title
window.Title = "Test window";
// Show window
window.Show();
}
示例7: ProjectWindowViewModel
public ProjectWindowViewModel(ChildWindow aChildWindow, ProjectWindowType aProductWindowType, ProjectEntity aProjectEntity)
{
childWindow = aChildWindow;
ProjectEntity = aProjectEntity;
if (!String.IsNullOrWhiteSpace(ProjectEntity.ManufactureNumber))
{
Title = "生产令号:" + ProjectEntity.ManufactureNumber;
}
else
{
Title = "添加";
}
projectWindowType = aProductWindowType;
if (projectWindowType == ProjectWindowType.Modify)
{
IsModify = true;
IsAdd = false;
}
else if (projectWindowType == ProjectWindowType.ADD)
{
IsAdd = true;
IsModify = true;
}
else if (projectWindowType == ProjectWindowType.View)
{
IsAdd = false;
IsModify = false;
}
OnOK = new DelegateCommand(OnOKCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
}
示例8: DepartmentWindowViewModel
public DepartmentWindowViewModel(ChildWindow aChildWindow, DepartmentEntity aDepartmentEntity)
{
childWindow = aChildWindow;
DepartmentEntity = aDepartmentEntity;
OnOK = new DelegateCommand(OnOKCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
}
示例9: LinkResponsePersonModel
public LinkResponsePersonModel(ChildWindow aChildWindow
, ProductDomainContext aProductDomainContext
, Dictionary<int, DepartmentEntity> aDepartmentEntityDictionary
, Dictionary<String, UserEntity> aUserEntityDictionary)
{
ProductDomainContext = aProductDomainContext;
childWidow = aChildWindow;
DepartmentEntityDictionary = aDepartmentEntityDictionary;
UserEntityDictionary = aUserEntityDictionary;
ProjectEntityList = new ObservableCollection<ProjectEntity>();
ProjectLinkEntityList = new ObservableCollection<ProjectEntity>();
ProjectResponsibleEntityList = new ObservableCollection<ProjectResponsibleEntity>();
ProjectResponsibleEntityALLList = new ObservableCollection<ProjectResponsibleEntity>();
OnReflash = new DelegateCommand(OnReflashCommand);
OnAddToProject = new DelegateCommand(OnAddToProjectCommand);
OnRemoveProject = new DelegateCommand(OnRemoveProjectCommand);
OnOk = new DelegateCommand(OnOkCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
projectSource = new EntityList<ProductManager.Web.Model.project>(ProductDomainContext.projects);
projectLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project>(
LoadProjectEntities,
LoadOperationProjectCompleted
);
projectView = new DomainCollectionView<ProductManager.Web.Model.project>(projectLoader, projectSource);
projectResponsibSource = new EntityList<ProductManager.Web.Model.project_responsible>(ProductDomainContext.project_responsibles);
projectResponsibLoader = new DomainCollectionViewLoader<ProductManager.Web.Model.project_responsible>(
LoadProjectResponseEntities,
LoadOperationProjectResponseCompleted
);
projectResponsibleView = new DomainCollectionView<ProductManager.Web.Model.project_responsible>(projectResponsibLoader, projectResponsibSource);
}
示例10: ImportProductWindowViewModel
public ImportProductWindowViewModel(ChildWindow aChildWindow
, ProductDomainContext aProductDomainContext
, Dictionary<String, ProjectEntity> aProjectEntityDictionary
, Dictionary<String, ProductEntity> aProductEntityDictionary
, Dictionary<int, ProductTypeEntity> aProductTypeEntityDictionary)
{
childWindow = aChildWindow;
ProductContext = aProductDomainContext;
ProductEntityList = new ObservableCollection<ProductEntity>();
ProjectEntityDictionary = aProjectEntityDictionary;
ProductEntityDictionary = aProductEntityDictionary;
ProductTypeEntityDictionary = aProductTypeEntityDictionary;
CurrentProductEntityDicationary = new Dictionary<string, ProductEntity>();
OnImport = new DelegateCommand(OnImportCommand);
OnDownloadTemp = new DelegateCommand(OnDownloadTempCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
OnOK = new DelegateCommand(OnOKCommand);
ProductTypeIDDictionary = new Dictionary<string, int>();
foreach (KeyValuePair<int, ProductTypeEntity> keyValuePairProductType in ProductTypeEntityDictionary)
{
ProductTypeIDDictionary.Add(keyValuePairProductType.Value.ProductTypeName, keyValuePairProductType.Value.ProductTypeID);
}
}
示例11: UpdateFileWindowViewModel
public UpdateFileWindowViewModel(ChildWindow aChildWindow, ObservableCollection<FileTypeEntity> aFileTypeEntityList, ObservableCollection<ProjectFilesEntity> aProjectFilesEntityList, ProjectFilesEntity aProjectFileEntity)
{
UserFile = new FileUploader.UserFile();
ProjectFilesEntity = aProjectFileEntity;
ProjectFilesEntityList = aProjectFilesEntityList;
FileTypeEntityList = aFileTypeEntityList;
childWindow = aChildWindow;
FileTypes = new List<String>();
App app = Application.Current as App;
bool lIsPermis;
if (app.UserInfo.UserAction.TryGetValue(2020100, out lIsPermis))
{
if (lIsPermis)
{
FileTypes.Add("合同协议文件");
ProjectFilesEntity.fileType = "合同协议文件";
}
}
if (app.UserInfo.UserAction.TryGetValue(2020200, out lIsPermis))
{
if (lIsPermis)
{
FileTypes.Add("配置文件");
ProjectFilesEntity.fileType = "配置文件";
}
}
Title = "上传文件 生产令号:" + ProjectFilesEntity.ManufactureNumber;
OnOpenFile = new DelegateCommand(OnOpenFileCommand);
OnUpdate = new DelegateCommand(OnUpdateCommand, CanUpdateCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
}
示例12: ProductPartTypeWindowViewModel
public ProductPartTypeWindowViewModel(ChildWindow aChildWindow, ProductPartTypeEntity aProductPartTypeEntity)
{
childWindow = aChildWindow;
ProductPartTypeEntity = aProductPartTypeEntity;
OnOK = new DelegateCommand(OnOKCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
}
示例13: mmf_DoubleClick
private void mmf_DoubleClick(object sender, MouseButtonEventArgs e)
{
TimeSpan span;
if (sender == lastClickItem)
{
DateTime now = DateTime.Now;
span = now - lastClicked;
if (span.Milliseconds < 300)
{
var child = new ChildWindow();
child.Show();
child.Closed += delegate {
};
}
else
{
lastClickItem = null;
}
}
lastClicked = DateTime.Now;
lastClickItem = sender;
}
示例14: QuestionTraceWindowViewModel
public QuestionTraceWindowViewModel(ChildWindow aChildWindow, QuestionTraceOperation aQuestionTraceOperation, ObservableCollection<UserEntity> aUserEntityList, ObservableCollection<DepartmentEntity> aDepartmentEntityList, QuestionTraceEntity aQuestionTraceEntity )
{
childWindow = aChildWindow;
QuestionTraceOperation = aQuestionTraceOperation;
DepartmentEntityList = aDepartmentEntityList;
UserEntityList = aUserEntityList;
QuestionTraceEntity = aQuestionTraceEntity;
OnOK = new DelegateCommand(OnOKCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
if (aQuestionTraceOperation == QuestionTraceOperation.ADD)
{
IsAdd = true;
IsAnswer = false;
Title = "添加问题 " + QuestionTraceEntity.ManufactureNumber;
}
else if (aQuestionTraceOperation == QuestionTraceOperation.ANSWER)
{
IsAdd = false;
IsAnswer = true;
Title = "回答问题 " + QuestionTraceEntity.ManufactureNumber;
}
else if (aQuestionTraceOperation == QuestionTraceOperation.VIEW)
{
IsAdd = false;
IsAnswer = false;
Title = "查看问题 " + QuestionTraceEntity.ManufactureNumber;
}
else if (aQuestionTraceOperation == QuestionTraceOperation.CLOSE)
{
IsAdd = false;
IsAnswer = false;
Title = "关闭问题 " + QuestionTraceEntity.ManufactureNumber;
}
}
示例15: LinkFileViewModel
public LinkFileViewModel(ChildWindow aChildWindow, Dictionary<int, FileTypeEntity> aFileTypeDictionary)
{
documentManagerContext = new Web.DocumentManagerDomainContext();
childWindow = aChildWindow;
SelectTaxPayerDocumentEntitis = new ObservableCollection<TaxPayerDocumentEntity>();
TaxPayerEntityList = new ObservableCollection<TaxPayerEntity>();
TaxPayerEntityLinkList = new ObservableCollection<TaxPayerEntity>();
TaxPayerDocumentEntityList = new ObservableCollection<TaxPayerDocumentEntity>();
FileTypeEntityDictionary = aFileTypeDictionary;
GroupID = 1;
OnOK = new DelegateCommand(OnOKCommand, CanOKCommand);
OnCancel = new DelegateCommand(OnCancelCommand);
OnReflash = new DelegateCommand(OnReflashCommand);
OnAddToTaxPayer = new DelegateCommand(OnAddToTaxPayerCommand);
OnRemoveTaxPayer = new DelegateCommand(OnRemoveTaxPayerCommand);
taxPayerSource = new EntityList<DocumentManager.Web.Model.taxpayer>(documentManagerContext.taxpayers);
taxPayerLoader = new DomainCollectionViewLoader<DocumentManager.Web.Model.taxpayer>(
LoadTaxPayerEntities,
LoadOperationTaxPayerCompleted
);
taxPayerView = new DomainCollectionView<DocumentManager.Web.Model.taxpayer>(taxPayerLoader, taxPayerSource);
taxPayerDocumentSource = new EntityList<DocumentManager.Web.Model.taxpayerdocument>(documentManagerContext.taxpayerdocuments);
taxPayerDocumentLoader = new DomainCollectionViewLoader<DocumentManager.Web.Model.taxpayerdocument>(
LoadTaxPayerDocumentEntities,
LoadOperationTaxPayerDocumentCompleted
);
taxPayerDocumentView = new DomainCollectionView<DocumentManager.Web.Model.taxpayerdocument>(taxPayerDocumentLoader, taxPayerDocumentSource);
}