本文整理汇总了C#中IScreen类的典型用法代码示例。如果您正苦于以下问题:C# IScreen类的具体用法?C# IScreen怎么用?C# IScreen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IScreen类属于命名空间,在下文中一共展示了IScreen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContextMenuModel
public ContextMenuModel(IScreen owner, string name, string displayName, Bitmap image = null)
{
Owner = owner;
Name = name;
DisplayName = displayName;
Image = image;
}
示例2: EdgeMovement
/// <summary>
/// Erzeugt eine neue Instanz eines EdgeMovement-Objekts und initialisiert diese
/// mit ihrem zugehörigen IGameScreen-Objekt screen, der Spielwelt world und
/// Objektinformationen info.
/// </summary>
public EdgeMovement(IScreen screen, World world, KnotRenderer knotRenderer, Vector3 position)
: base(screen, DisplayLayer.None)
{
Screen = screen;
World = world;
KnotRenderer = knotRenderer;
}
示例3: UserPreferencesPageViewModel
public UserPreferencesPageViewModel (IScreen hostScreen, UserSettings userSettings)
{
HostScreen = hostScreen;
var tempPrefChanged = this.WhenAnyValue (x => x.TemperaturePreference).StartWith (userSettings.TemperaturePreference);
tempPrefChanged
.Subscribe (x => userSettings.TemperaturePreference = x);
tempPrefChanged
.Select (x => x == TemperatureUnit.Celsius ? "C" : "F")
.ToProperty (this, vm => vm.TempPreferenceLabel, out _TempPreferenceLabel);
// var volumePrefChanged = this.WhenAnyValue (x => x.VolumePreference);
// volumePrefChanged
// .StartWith (userSettings.VolumePreference)
// .Do (x => System.Diagnostics.Debug.WriteLine ("setting vol pref {0}", x))
// .Subscribe (x => userSettings.VolumePreference = x);
//
// var equipLossChanged = this.WhenAnyValue (x => x.EquipmentLossVolume);
//
// equipLossChanged
// .StartWith (userSettings.EquipmentLossVolume)
// .Subscribe (x => userSettings.EquipmentLossVolume = x);
//
// var trubLossChanged = this.WhenAnyValue (x => x.TrubLossVolume);
//
// trubLossChanged
// .StartWith (userSettings.TrubLossVolume)
// .Subscribe (x => userSettings.TrubLossVolume = x);
}
示例4: Pipe
/// <summary>
/// Erstellt ein neues Informationsobjekt für ein 3D-Modell, das eine Kante darstellt.
/// [base="pipe1", Angles3.Zero, new Vector3 (10,10,10)]
/// </summary>
public Pipe(IScreen screen, IGrid grid, Knot knot, Edge edge, Node node1, Node node2)
: base(screen: screen)
{
UniqueKey = edge.ToString ();
// Weise Knoten und Kante zu
Knot = knot;
Edge = edge;
Grid = grid;
// Berechne die beiden Positionen, zwischen denen die Kante gezeichnet wird
PositionFrom = node1;
PositionTo = node2;
// Kanten sind verschiebbar und auswählbar
IsMovable = true;
IsSelectable = true;
// Berechne die Drehung
Rotation += RotationMap [Edge.Direction];
// Aktualisiere die Kategorie
Coloring.OnColorChanged += UpdateCategory;
IsSingleColored = true;
incomplete = true;
}
示例5: PersonListViewModel
public PersonListViewModel(IScreen hostScreen, IPersonRepository personRepository = null)
{
HostScreen = hostScreen;
personRepository = personRepository ?? new PersonRepository();
Persons = new ReactiveList<PersonItemViewModel>();
NewPersonCommand = new ReactiveCommand(null);
NewPersonCommand.RegisterAsyncAction(_ => { }).Subscribe(_ => HostScreen.Router.Navigate.Execute(new PersonAddViewModel(HostScreen)));
RefreshCommand = new ReactiveCommand(null);
var refresh = RefreshCommand.RegisterAsync<List<Person>>(_ => Observable.Start(() => personRepository.RetrievePersonsAsync().
Result));
refresh.Subscribe(list =>
{
using (Persons.SuppressChangeNotifications())
{
Persons.Clear();
Persons.AddRange(personRepository.RetrievePersonsAsync().
Result.Select(d => new PersonItemViewModel(d.FirstName,
d.LastName,
d.Age)));
}
});
MessageBus.Current.Listen<Person>().
Subscribe(p =>
{
personRepository.AddPerson(p);
RefreshCommand.Execute(null);
});
}
示例6: TextInputDialog
/// <summary>
/// Erstelle einen neuen TextInputDialog.
/// </summary>
public TextInputDialog(IScreen screen, DisplayLayer drawOrder, string title, string text, string inputText)
: base(screen, drawOrder, title)
{
textItem = new TextItem (screen, drawOrder, String.Empty);
Cancel = (time) => {
Close (time);
};
Submit = (time) => {
Close (time);
};
Bounds.Size = new ScreenPoint (screen, 0.5f, 0.3f);
// Der Titel-Text ist mittig ausgerichtet
AlignX = HorizontalAlignment.Center;
menu = new Menu (Screen, Index + DisplayLayer.Menu);
menu.Bounds = ContentBounds;
menu.Bounds.Padding = new ScreenPoint (screen, 0.010f, 0.019f);
menu.ItemAlignX = HorizontalAlignment.Left;
menu.ItemAlignY = VerticalAlignment.Center;
//die Texteingabe
textInput = new InputItem (Screen, Index + DisplayLayer.MenuItem, text, inputText);
menu.Add (textInput);
menu.Add (textItem);
textInput.IsEnabled = true;
textInput.IsInputEnabled = true;
textInput.NameWidth = 0.35f;
textInput.ValueWidth = 0.65f;
ValidKeys.AddRange (new Keys[] { Keys.Enter, Keys.Escape });
}
示例7: TwoFactorViewModel
public TwoFactorViewModel(IScreen host)
{
HostScreen = host;
var codeHasBeenInput = this.WhenAny(x => x.Code, code => !string.IsNullOrWhiteSpace(code.Value));
Submit = new ReactiveCommand(codeHasBeenInput);
}
示例8: AddScreen
public void AddScreen(IScreen screen)
{
_screens.Add(screen);
if (_screens.Count == 1)
_activeScreen = screen;
}
示例9: HomeViewModel
public HomeViewModel(ITelephonyService telephonyService = null, IScreen hostScreen = null)
{
TelephonyService = telephonyService ?? Locator.Current.GetService<ITelephonyService>();
HostScreen = hostScreen ?? Locator.Current.GetService<IScreen>();
var canComposeSMS = this.WhenAny(x => x.Recipient, x => !string.IsNullOrWhiteSpace(x.Value));
ComposeSMS = ReactiveCommand.CreateAsyncTask(canComposeSMS,
async _ => { await TelephonyService.ComposeSMS(Recipient); });
ComposeSMS.ThrownExceptions.Subscribe(
ex => UserError.Throw("Does this device have the capability to send SMS?", ex));
var canComposeEmail = this.WhenAny(x => x.Recipient, x => !string.IsNullOrWhiteSpace(x.Value));
ComposeEmail = ReactiveCommand.CreateAsyncTask(canComposeEmail, async _ =>
{
var email = new Email(Recipient);
await TelephonyService.ComposeEmail(email);
});
ComposeEmail.ThrownExceptions.Subscribe(
ex => UserError.Throw("The recipient is potentially not a well formed email address.", ex));
var canMakePhoneCall = this.WhenAny(x => x.Recipient, x => !string.IsNullOrWhiteSpace(x.Value));
MakePhoneCall = ReactiveCommand.CreateAsyncTask(canMakePhoneCall,
async _ => { await TelephonyService.MakePhoneCall(Recipient); });
MakePhoneCall.ThrownExceptions.Subscribe(
ex => UserError.Throw("Does this device have the capability to make phone calls?", ex));
var canMakeVideoCall = this.WhenAny(x => x.Recipient, x => !string.IsNullOrWhiteSpace(x.Value));
MakeVideoCall = ReactiveCommand.CreateAsyncTask(canMakeVideoCall,
async _ => { await TelephonyService.MakeVideoCall(Recipient); });
MakeVideoCall.ThrownExceptions.Subscribe(
ex => UserError.Throw("Does this device have the capability to make video calls?", ex));
}
示例10: StoryTellerTabItem
public StoryTellerTabItem(IScreen screen, IEventAggregator events)
{
_screen = screen;
_item = new TabItem();
Func<Action<IScreenConductor>, Action> sendMessage = a => () => events.SendMessage(a);
_item.Header = new StackPanel().Horizontal()
.Configure(x =>
{
x.Height = 25;
})
.AddText(screen.Title, x => _label = x)
.Add(new TabCloser(sendMessage(s => s.Close(screen))));
_label.VerticalAlignment = VerticalAlignment.Center;
_label.Margin = new Thickness(0, 0, 5, 0);
_item.Content = new DockPanel().With(screen.View);
_item.Tag = screen;
// Sets up a context menu for each tab in the screen that can capture "Close"
// messages
_item.ContextMenu = new ContextMenu().Configure(o =>
{
o.AddItem("Close", sendMessage(s => s.Close(screen)));
o.AddItem("Close All But This", sendMessage(s => s.CloseAllBut(screen)));
o.AddItem("Close All", sendMessage(s => s.CloseAll()));
});
}
示例11: LoginRouteViewModel
public LoginRouteViewModel(IScreen hostScreen)
{
HostScreen = hostScreen;
var authentication = new Authentication();
var canLogin = this.WhenAny(x => x.LoginName,
x => x.Password,
(l, p) => !String.IsNullOrWhiteSpace(l.Value) && !String.IsNullOrWhiteSpace(p.Value));
LoginCommand = new ReactiveCommand(canLogin);
var loggedIn = LoginCommand.RegisterAsync(_ => Observable.Start(() =>
{
var authenticationResult = authentication.AuthenticateAsync(LoginName,
Password).
Result;
return authenticationResult == AuthenticationResult.Authenticated
? "Přihlášen"
: "Nepřihlášen";
}));
loggedIn.Subscribe(s =>
{
if (s == "Přihlášen")
HostScreen.Router.Navigate.Execute(new PersonListViewModel(HostScreen));
});
message = new ObservableAsPropertyHelper<string>(loggedIn,
s => raisePropertyChanged("Message"));
}
示例12: TextBox
/// <summary>
/// Erzeugt ein neues TextItem-Objekt und initialisiert dieses mit dem zugehörigen IGameScreen-Objekt.
/// Zudem sind Angabe der Zeichenreihenfolge und der Zeichenkette, die angezeigt wird, für Pflicht.
/// </summary>
public TextBox(IScreen screen, DisplayLayer drawOrder, string text)
: base(screen, drawOrder)
{
Text = text;
State = WidgetState.None;
spriteBatch = new SpriteBatch (screen.GraphicsDevice);
}
示例13: MainViewModel
public MainViewModel(IScreen screen, ISettingsManager settingsManager, IVersionManager versionManager)
{
HostScreen = screen;
Games = new GamesViewModel(Locator.Current);
Downloads = new DownloadsViewModel(Locator.Current.GetService<IJobManager>());
Messsages = new MessagesViewModel(Locator.Current.GetService<IDatabaseManager>(), Locator.Current.GetService<IMessageManager>());
GotoSettings = ReactiveCommand.CreateAsyncObservable(_ => screen.Router.Navigate.ExecuteAsync(new SettingsViewModel(screen, settingsManager, versionManager, Locator.Current.GetService<IGameManager>())));
// login status
settingsManager.WhenAnyValue(sm => sm.AuthenticatedUser)
.Select(u => u == null ? "Not logged." : $"Logged as {u.Name}")
.ToProperty(this, x => x.LoginStatus, out _loginStatus);
// show notice when new version arrives but hide when button was clicked
versionManager.NewVersionAvailable
.Where(release => release != null)
.Subscribe(newRelease => {
ShowUpdateNotice = true;
});
CloseUpdateNotice.Subscribe(_ => {
ShowUpdateNotice = false;
});
// restart button
RestartApp.Subscribe(_ => { UpdateManager.RestartApp(); });
}
示例14: GetQualifiedViewModelName
/// <summary>
/// Gets the fully qualified name of a ViewModel. Just adds the AssemblyQualifiedName to the <see cref="GetViewModelName"/>.
/// </summary>
/// <param name="screen">The screen</param>
/// <param name="targetPostFix">Either <see cref="HomePostFix"/> or <see cref="SinglePostFix"/></param>
/// <param name="viewModelPostFix">The <see cref="ViewModelPostFix"/></param>
/// <returns>The fully qualified ViewModel-Name</returns>
private static string GetQualifiedViewModelName(IScreen screen, string targetPostFix, string viewModelPostFix)
{
string qualifiedName = screen.GetType().AssemblyQualifiedName;
return qualifiedName.Replace(
screen.GetType().Name,
GetViewModelName(screen, targetPostFix, viewModelPostFix));
}
示例15: Button
/// <summary>
/// Erzeugt ein neues MenuButton-Objekt und initialisiert dieses mit dem zugehörigen IGameScreen-Objekt.
/// Zudem sind Angabe der Zeichenreihenfolge, einer Zeichenkette für den Namen der Schaltfläche
/// und der Aktion, welche bei einem Klick ausgeführt wird Pflicht.
/// </summary>
public Button(IScreen screen, DisplayLayer drawOrder, string name, Action<GameTime> onClick)
: base(screen, drawOrder)
{
this.name = name;
OnClick = onClick;
spriteBatch = new SpriteBatch (screen.GraphicsDevice);
}