本文整理汇总了C#中CustomMessageBox类的典型用法代码示例。如果您正苦于以下问题:C# CustomMessageBox类的具体用法?C# CustomMessageBox怎么用?C# CustomMessageBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CustomMessageBox类属于命名空间,在下文中一共展示了CustomMessageBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
public void Show(string text, string firstOption, string secondOption, Action firstAction, Action secondAction)
{
Mvx.Resolve<IMvxMainThreadDispatcher>().RequestMainThreadAction(() =>
{
_messageBox = new CustomMessageBox
{
AllowDrop = false,
Message = text,
IsLeftButtonEnabled = true,
IsRightButtonEnabled = true,
LeftButtonContent = firstOption,
RightButtonContent = secondOption
};
_messageBox.Dismissed += (s, e) =>
{
if (e.Result == CustomMessageBoxResult.LeftButton && firstAction != null)
{
firstAction();
}
else if (e.Result == CustomMessageBoxResult.RightButton && secondAction != null)
{
secondAction();
}
};
_messageBox.Show();
});
}
示例2: RunRateAppCheck
private void RunRateAppCheck()
{
var messageBox = new CustomMessageBox()
{
Caption = Messages.MainPage_RateHeader,
Message = Messages.MainPage_DoYouLikeApp,
LeftButtonContent = UILabels.Common_Yes,
RightButtonContent = UILabels.Common_No
};
messageBox.Dismissed += (s1, e1) =>
{
switch (e1.Result)
{
case CustomMessageBoxResult.LeftButton: // yes
InitRateRequest();
break;
case CustomMessageBoxResult.RightButton: // no
InitEmailRequest();
break;
default:
App.ApplicationSettings.LastCoolDownActivated = DateTime.UtcNow;
break;
}
};
messageBox.Show();
}
示例3: MainForm
public MainForm(AppManager manager)
{
_flgLoading = true;
InitializeComponent();
_manager = manager;
if (_manager == null)
{
CustomMessageBox cmb = new CustomMessageBox("The application manager has not been loaded for some reason.\nThe application can't work and will be closed.", "FATAL", MessageBoxDialogButtons.Ok, MessageBoxDialogIcon.Fatal, false, false);
cmb.ShowDialog();
cmb.Dispose();
this.Close();
}
InitializeStyle();
InitializeGUIEventsHandlers();
categoriesTabs.Manager = _manager;
SetupUI();
_SelectedCategory = -1;
_SelectedGame = -1;
EnableMenus(false);
if (_manager.AppSettings.ReloadLatestDB && (_manager.RecentDBs != null && _manager.RecentDBs.Count > 0))
OpenRecentDatabase(_manager.RecentDBs.First().Value.DBPath, false);
_flgLoading = false;
}
示例4: lstAdapters_SelectionChanged
private void lstAdapters_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
lstAdapterItem selItem = ((lstAdapterItem)lstAdapters.SelectedItem);
TextBox dnsBox = new TextBox() { Text = selItem.PrimaryDNS };
TiltEffect.SetIsTiltEnabled(dnsBox, true);
CustomMessageBox messageBox = new CustomMessageBox()
{
Caption = "Edit DNS for " + selItem.Name,
Message = "Primary DNS Server:",
Content = dnsBox,
LeftButtonContent = "save",
RightButtonContent = "cancel",
IsFullScreen = false
};
messageBox.Dismissed += (s1, e1) =>
{
if (e1.Result == CustomMessageBoxResult.LeftButton)
{
Registry.SetMultiStringValue(selItem.KeyRoot, selItem.KeyPath, "DNS", new string[] { dnsBox.Text });
//TODO: Clear the list first
refreshAdapters();
}
//TODO: Fix this
//lstAdapters.SelectedIndex = -1;
};
messageBox.Show();
}
示例5: CheckForPreviousException
internal static void CheckForPreviousException(bool isFirstRun)
{
try
{
string contents = null;
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
if (store.FileExists(filename))
{
using (TextReader reader = new StreamReader(store.OpenFile(filename, FileMode.Open, FileAccess.Read, FileShare.None)))
{
contents = reader.ReadToEnd();
}
SafeDeleteFile(store);
}
}
if (contents != null)
{
string messageBoxText = null;
if (isFirstRun)
messageBoxText = "An unhandled error occurred the last time you ran this application. Would you like to send an email to report it?";
else
messageBoxText = "An unhandled error has just occurred. Would you like to send an email to report it?";
CustomMessageBox messageBox = new CustomMessageBox()
{
Caption = "Error Report",
Message = messageBoxText,
LeftButtonContent = "yes",
RightButtonContent = "no",
IsFullScreen = false
};
messageBox.Dismissed += (s1, e1) =>
{
switch (e1.Result)
{
case CustomMessageBoxResult.LeftButton:
FeedbackHelper.Default.Feedback(contents, true);
SafeDeleteFile(IsolatedStorageFile.GetUserStoreForApplication());
break;
default:
break;
}
};
messageBox.Show();
}
}
catch (Exception)
{
}
finally
{
SafeDeleteFile(IsolatedStorageFile.GetUserStoreForApplication());
}
}
示例6: appbar_buttonAdd_Click
//添加商家
private void appbar_buttonAdd_Click(object sender, EventArgs e)
{
TextBox txtBox = new TextBox();
CustomMessageBox msgBox = new CustomMessageBox()
{
Caption = "添加商家",
LeftButtonContent = "保存",
RightButtonContent = "取消",
Content = txtBox
};
msgBox.Dismissing += (s1, e1) =>
{
switch (e1.Result)
{
case CustomMessageBoxResult.LeftButton:
SaveStore(txtBox.Text.Trim());
StoreListBox.ItemsSource = Common.GetAllStore();
break;
case CustomMessageBoxResult.RightButton:
break;
case CustomMessageBoxResult.None:
break;
default: break;
}
};
msgBox.Show();
}
示例7: appbar_buttonDelete_Click
private void appbar_buttonDelete_Click(object sender, EventArgs e)
{
CustomMessageBox msgBox = new CustomMessageBox()
{
Caption = "删除流水",
Message = "确定要删除这条流水吗?",
LeftButtonContent = "确定",
RightButtonContent = "取消"
};
msgBox.Dismissing += (s1, e1) =>
{
switch (e1.Result)
{
case CustomMessageBoxResult.LeftButton:
App.voucherHelper.Remove(item);
App.voucherHelper.SaveToFile();
//删掉就相当于转回去
App.accountHelper.UpdateBalanceTrans(item.Account2, item.Account1, item.Money);
App.accountHelper.SaveToFile();
NavigationService.GoBack();
break;
case CustomMessageBoxResult.RightButton:
break;
case CustomMessageBoxResult.None:
break;
default: break;
}
};
msgBox.Show();
}
示例8: ShowDialogBox
public void ShowDialogBox(string caption, string message, string leftbuttonContent, string rightButtonContent, Action leftButtonAction, Action rightButtonAction)
{
var messagebox = new CustomMessageBox()
{
Caption = caption,
Message = message,
LeftButtonContent = leftbuttonContent,
RightButtonContent = rightButtonContent
};
messagebox.Dismissed += (s,e) =>
{
switch (e.Result)
{
case CustomMessageBoxResult.LeftButton:
leftButtonAction();
break;
case CustomMessageBoxResult.RightButton:
rightButtonAction();
break;
case CustomMessageBoxResult.None:
break;
};
};
messagebox.Show();
}
示例9: MainPage
public MainPage()
{
InitializeComponent();
messageBox = new CustomMessageBox()
{
Message = "Приложение может использовать данные о вашем местоположении для отображения их на карте (эти данные никуда не передаются и не хранятся). Вы можете отключить это в настройках программы.",
Caption = "Разрешить использовать сведения о местоположении?",
LeftButtonContent = "Разрешить",
RightButtonContent = "Запретить",
};
messageBox.Dismissed += (s1, e1) =>
{
switch (e1.Result)
{
case CustomMessageBoxResult.LeftButton:
Settings.IsNavigationEnabled = true;
break;
case CustomMessageBoxResult.RightButton:
case CustomMessageBoxResult.None:
Settings.IsNavigationEnabled = false;
break;
default:
break;
}
};
this.Loaded += (s, e) =>
{
if(!IsolatedStorageSettings.ApplicationSettings.Contains("IsNavigationEnabled"))
messageBox.Show();
};
}
示例10: appbar_buttonAdd_Click
//添加分类
private void appbar_buttonAdd_Click(object sender, EventArgs e)
{
string kind = pivot.SelectedIndex > 0 ? "收入" : "支出";
TextBox txtBox = new TextBox();
CustomMessageBox msgBox = new CustomMessageBox()
{
Caption = "添加" + kind + "分类",
LeftButtonContent = "保存",
RightButtonContent = "取消",
Content = txtBox
};
msgBox.Dismissing += (s1, e1) =>
{
switch(e1.Result)
{
case CustomMessageBoxResult.LeftButton:
SaveCategory(txtBox.Text.Trim());
FreshList();
break;
case CustomMessageBoxResult.RightButton:
break;
case CustomMessageBoxResult.None:
break;
default: break;
}
};
msgBox.Show();
}
示例11: ShowDialogBox
public Task<bool> ShowDialogBox(string caption, string message, string leftbuttonContent, string rightButtonContent, Func<Task> leftButtonAction, Func<Task> rightButtonAction)
{
var messagebox = new CustomMessageBox()
{
Caption = caption,
Message = message,
LeftButtonContent = leftbuttonContent,
RightButtonContent = rightButtonContent
};
var tcs = new TaskCompletionSource<bool>();
messagebox.Dismissed += async (s, e) =>
{
switch (e.Result)
{
case CustomMessageBoxResult.LeftButton:
await leftButtonAction();
tcs.SetResult(true);
break;
case CustomMessageBoxResult.RightButton:
await rightButtonAction();
tcs.SetResult(true);
break;
case CustomMessageBoxResult.None:
tcs.SetResult(false);
break;
};
};
messagebox.Show();
return tcs.Task;
}
示例12: btSelecionarCliente_Click
private void btSelecionarCliente_Click(object sender, RoutedEventArgs e)
{
UCSelecaoCliente ucsc = new UCSelecaoCliente();
CustomMessageBox cmb = new CustomMessageBox()
{
Content = ucsc,
LeftButtonContent = "Selecionar",
RightButtonContent = "Cancelar"
};
cmb.Dismissing += (s1, e1) =>
{
switch (e1.Result)
{
case CustomMessageBoxResult.LeftButton:
if (ucsc.listClientes.SelectedItem == null)
e1.Cancel = true;
if (ucsc.listClientes.SelectedItem != null)
{
novoPedido.IdCliente = (ucsc.listClientes.SelectedItem as Cliente).Id;
btSelecionarCliente.Content = (ucsc.listClientes.SelectedItem as Cliente).Nome;
}
break;
}
};
cmb.Show();
}
示例13: ActionSheet
public override void ActionSheet(ActionSheetConfig config) {
var sheet = new CustomMessageBox {
Caption = config.Title,
IsLeftButtonEnabled = false,
IsRightButtonEnabled = false
};
var list = new ListBox {
FontSize = 36,
Margin = new Thickness(12.0),
SelectionMode = SelectionMode.Single,
ItemsSource = config.Options
.Select(x => new TextBlock {
Text = x.Text,
Margin = new Thickness(0.0, 12.0, 0.0, 12.0),
DataContext = x
})
};
list.SelectionChanged += (sender, args) => sheet.Dismiss();
sheet.Content = list;
sheet.Dismissed += (sender, args) => {
var txt = (TextBlock)list.SelectedValue;
var action = (ActionSheetOption)txt.DataContext;
if (action.Action != null)
action.Action();
};
this.Dispatch(sheet.Show);
}
示例14: BasicMessageBox_Click
private void BasicMessageBox_Click(object sender, RoutedEventArgs e)
{
CustomMessageBox messageBox = new CustomMessageBox()
{
Caption = "Pregunta?",
Message = "Mensaje del CustomMessageBox.",
LeftButtonContent = "Si",
RightButtonContent = "No",
IsFullScreen = (bool)FullScreenCheckBox.IsChecked
};
messageBox.Dismissed += (s1, e1) =>
{
switch (e1.Result)
{
case CustomMessageBoxResult.LeftButton:
// Acción.
break;
case CustomMessageBoxResult.RightButton:
// Acción.
break;
case CustomMessageBoxResult.None:
// Acción.
break;
default:
break;
}
};
messageBox.Show();
}
示例15: Accept
/// <summary>
/// Makes sure a message box is managed by this manager.
/// </summary>
/// <param name="wmb"></param>
private CustomMessageBox Accept(WF.Player.Core.MessageBox wmb)
{
CustomMessageBox cmb = null;
// Checks if this instance already manages this message box.
// If not, starts to manage the box.
KeyValuePair<CustomMessageBox, WF.Player.Core.MessageBox> pair = _WherigoMessageBoxes.SingleOrDefault(kv => kv.Value == wmb);
if (pair.Value == wmb)
{
// The target message box exists already.
cmb = pair.Key;
}
else
{
// Creates a target message box.
cmb = new CustomMessageBox()
{
Caption = App.Current.Model.Core.Cartridge.Name,
//Message = wmb.Text,
Content = new Controls.WherigoMessageBoxContentControl() { MessageBox = wmb },
LeftButtonContent = wmb.FirstButtonLabel ?? "OK",
RightButtonContent = wmb.SecondButtonLabel
};
// Registers events.
RegisterEventHandlers(cmb);
// Adds the pair to the dictionary.
_WherigoMessageBoxes.Add(cmb, wmb);
}
return cmb;
}