本文整理汇总了C#中AppState类的典型用法代码示例。如果您正苦于以下问题:C# AppState类的具体用法?C# AppState怎么用?C# AppState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AppState类属于命名空间,在下文中一共展示了AppState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AppInfo
public AppInfo(
string aName,
AppState aState,
bool aPendingUpdate,
bool aPendingDelete,
string aUdn,
string aFriendlyName,
bool aAutoUpdate,
string aUpdateUrl,
string aIconUrl,
AppVersion aVersion,
DateTime? aDownloadLastModified,
bool aIsSystemApp)
{
Name = aName;
State = aState;
PendingUpdate = aPendingUpdate;
PendingDelete = aPendingDelete;
Udn = aUdn;
FriendlyName = aFriendlyName;
AutoUpdate = aAutoUpdate;
UpdateUrl = aUpdateUrl;
IconUrl = aIconUrl;
Version = aVersion;
DownloadLastModified = aDownloadLastModified;
IsSystemApp = aIsSystemApp;
}
开发者ID:weeble,项目名称:ohos,代码行数:27,代码来源:AppShellImpl.cs
示例2: Run
public void Run(IBackgroundTaskInstance taskInstance)
{
smtc = BackgroundMediaPlayer.Current.SystemMediaTransportControls;
smtc.ButtonPressed += Smtc_ButtonPressed;
smtc.PropertyChanged += Smtc_PropertyChanged;
smtc.IsEnabled = true;
smtc.IsPauseEnabled = true;
smtc.IsPlayEnabled = true;
smtc.IsNextEnabled = true;
smtc.IsPreviousEnabled = true;
var value = ApplicationSettingsHelper.ReadResetSettingsValue(ApplicationSettingsConstants.AppState);
if (value == null)
foregroundAppState = AppState.Unknown;
else
foregroundAppState = EnumHelper.Parse<AppState>(value.ToString());
BackgroundMediaPlayer.Current.CurrentStateChanged += Current_CurrentStateChanged;
BackgroundMediaPlayer.MessageReceivedFromForeground += BackgroundMediaPlayer_MessageReceivedFromForeground;
if (foregroundAppState != AppState.Suspended)
MessageService.SendMessageToForeground(new BackgroundTaskStateChangedMessage(BackgroundTaskState.Running));
ApplicationSettingsHelper.SaveSettingsValue(ApplicationSettingsConstants.BackgroundTaskState, BackgroundTaskState.Running.ToString());
deferral = taskInstance.GetDeferral(); // This must be retrieved prior to subscribing to events below which use it
ReadytoConfirmFiles();
// Mark the background task as started to unblock SMTC Play operation (see related WaitOne on this signal)
taskInstance.Task.Completed += TaskCompleted;
taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled);
}
开发者ID:aurora-lzzp,项目名称:com.aurora.aumusic,代码行数:30,代码来源:BackgroundAudio.cs
示例3: LoadMarkupCategories
private void LoadMarkupCategories(Configuration.ApplicationRow application, AppState appState, OleDbConnection connection)
{
bool selected = false;
foreach (Configuration.ApplicationMarkupCategoryRow link in application.GetApplicationMarkupCategoryRows())
{
string roles = link.MarkupCategoryRow.IsAuthorizedRolesNull() ? "public" : link.MarkupCategoryRow.AuthorizedRoles;
if (AppUser.RoleIsInList(roles, connection))
{
HtmlGenericControl option = new HtmlGenericControl("option");
option.Attributes["value"] = link.CategoryID;
option.InnerText = link.MarkupCategoryRow.DisplayName;
if (link.CategoryID == appState.MarkupCategory)
{
option.Attributes["selected"] = "selected";
selected = true;
}
ddlMarkupCategory.Controls.Add(option);
}
}
if (!selected)
{
appState.MarkupCategory = "";
appState.MarkupGroups = new StringCollection();
if (ddlMarkupCategory.Controls.Count > 0)
{
appState.MarkupCategory = ((HtmlGenericControl)ddlMarkupCategory.Controls[0]).Attributes["value"];
}
}
}
开发者ID:ClaireBrill,项目名称:GPV,代码行数:35,代码来源:MarkupPanel.ascx.cs
示例4: startButton_Click
private void startButton_Click(object sender, EventArgs e)
{
endTime = DateTime.Now.AddMinutes(20);
timer.Start();
appState = AppState.Running;
UpdateTexts();
}
开发者ID:MikeEast,项目名称:Pomodorino,代码行数:7,代码来源:Form1.cs
示例5: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
appState = AppState.Initial;
timer.Interval = 1000;
timer.Tick += timer_Tick;
UpdateTexts();
}
开发者ID:MikeEast,项目名称:Pomodorino,代码行数:7,代码来源:Form1.cs
示例6: App
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
appState = AppState.OFFLINE;
this.InitializeComponent();
this.Suspending += OnSuspending;
this.Resuming += App_Resuming;
}
开发者ID:scottmeng,项目名称:ivle_metro_win8,代码行数:12,代码来源:App.xaml.cs
示例7: PdfMap
public PdfMap(AppState appState, string templateId, List<String> input, PreserveMode preserveMode, double originalWidth)
{
_appState = appState;
_templateId = templateId;
_input = input;
_preserveMode = preserveMode;
_originalWidth = originalWidth;
}
开发者ID:ClaireBrill,项目名称:GPV,代码行数:8,代码来源:PdfMap.cs
示例8: SetAppState
/// <summary>
/// 设置程序状态
/// </summary>
/// <param name="state"></param>
void SetAppState(AppState state)
{
appState = state;
this.btnStart.Enabled = (appState == AppState.Stoped);
this.btnStop.Enabled = (appState == AppState.Started);
this.txtBindAddr.Enabled = (appState == AppState.Stoped);
this.txtBindPort.Enabled = (appState == AppState.Stoped);
this.txtTargetAddr.Enabled = (appState == AppState.Stoped);
this.txtTargetPort.Enabled = (appState == AppState.Stoped);
this.txtDisConn.Enabled = (appState == AppState.Started);
this.btnDisconn.Enabled = (appState == AppState.Started && this.txtDisConn.Text.Length > 0);
}
开发者ID:andy521,项目名称:HP-Socket,代码行数:16,代码来源:frmProxyServer.cs
示例9: Initialize
public void Initialize(Configuration config, AppState appState, Configuration.ApplicationRow application)
{
using (OleDbConnection connection = AppContext.GetDatabaseConnection())
{
LoadMarkupCategories(application, appState, connection);
if (AppAuthentication.Mode != AuthenticationMode.None)
{
tboMarkupUser.Attributes["value"] = AppUser.GetDisplayName(connection);
tboMarkupUser.Attributes["disabled"] = "disabled";
chkMarkupLock.Style["visibility"] = "visible";
labMarkupLock.Style["visibility"] = "visible";
cmdNewMarkup.Attributes["class"] = "CommandLink";
}
}
}
开发者ID:ClaireBrill,项目名称:GPV,代码行数:16,代码来源:MarkupPanel.ascx.cs
示例10: stopButton_Click
private void stopButton_Click(object sender, EventArgs e)
{
switch (appState)
{
case AppState.Initial:
case AppState.Stopped:
Application.Exit();
break;
case AppState.Running:
case AppState.Alarming:
timer.Stop();
appState = AppState.Stopped;
break;
}
UpdateTexts();
}
开发者ID:MikeEast,项目名称:Pomodorino,代码行数:16,代码来源:Form1.cs
示例11: ResetCoordinates
public static void ResetCoordinates()
{
Globals.X1 = 0.00;
Globals.Y1 = 0.00;
Globals.X2 = 0.00;
Globals.Y2 = 0.00;
Globals.X3 = 0.00;
Globals.Y3 = 0.00;
Globals.X4 = 0.00;
Globals.Y4 = 0.00;
setCoordinates = false;
appState = AppState.firstCoordinate;
}
开发者ID:guozanhua,项目名称:kinect-ripple,代码行数:17,代码来源:Globals.cs
示例12: RegisterNotification
/// <summary>
/// Registers the notification.
/// </summary>
/// <param name="appState">State of the application.</param>
/// <exception cref="System.Configuration.ConfigurationErrorsException">AnalyticsNotifications Service URL setting is null or empty</exception>
public void RegisterNotification(AppState appState)
{
try
{
//Adding to group by projectId
Nlog.Log(LogLevel.Trace, "PC Web - Start addining connection into group");
Groups.Add(Context.ConnectionId, appState.ProjectId.ToString(CultureInfo.InvariantCulture));
Nlog.Log(LogLevel.Trace, "PC Web - Connection added to group");
if (BaseApiController.IsMockMode())
{
MockWorkflowState.WorkflowStateChanged += OnMockWorkflowStateChanged;
}
else
{
Nlog.Log(LogLevel.Trace, "PC Web - Fired RegisterNotification");
var serviceUri = ConfigurationManager.AppSettings.Get(AnalyticsNotifications);
if (String.IsNullOrEmpty(serviceUri))
{
throw new ConfigurationErrorsException("AnalyticsNotifications Service URL setting is null or empty");
}
var hubConnection = new HubConnection(serviceUri);
var serviceHubProxy = hubConnection.CreateHubProxy("WorkflowStateServiceHub");
//Handle incoming calls from service
//BroadcastWorkflowState for updated project
serviceHubProxy.On<long, List<AnalyticsWorkflowState>>("UpdateWorkflowState", BroadcastWorkflowState);
//Signalr service connection
Nlog.Log(LogLevel.Trace, "PC Web - Starting service signalr connection");
hubConnection.Start().ContinueWith(task => {}).Wait();
Nlog.Log(LogLevel.Trace, "PC Web - Service signalr connection success");
//Register for notifications
Nlog.Log(LogLevel.Trace, "PC Web - Invoking service signalr RegisterNotification");
serviceHubProxy.Invoke("RegisterNotification", appState.MatterId, appState.ProjectId)
.ContinueWith(task =>{}).Wait();
Nlog.Log(LogLevel.Trace, "PC Web - Invoked service signalr RegisterNotification");
}
}
catch (Exception ex)
{
Nlog.Log(LogLevel.Error, ex.GetBaseException());
}
}
开发者ID:Rajeshbharathi,项目名称:CGN.Paralegal,代码行数:50,代码来源:WorkflowStateHub.cs
示例13: timer_Tick
void timer_Tick(object sender, EventArgs e)
{
switch (appState)
{
case AppState.Running:
var remainingTime = (DateTime.Now - endTime);
timeDisplay.Text = remainingTime.ToString("mm\\:ss");
if (remainingTime.TotalSeconds >= 0)
{
appState = AppState.Alarming;
UpdateTexts();
}
break;
case AppState.Alarming:
System.Media.SystemSounds.Beep.Play();
break;
}
}
开发者ID:MikeEast,项目名称:Pomodorino,代码行数:18,代码来源:Form1.cs
示例14: Initialize
private void Initialize(AppState appState, int width, int height, double resolution)
{
_appState = appState;
_width = width;
_height = height;
_resolution = resolution;
if (_width * _resolution > 2048)
{
_resolution *= 2048 / (_resolution * _width);
}
if (_height * _resolution > 2048)
{
_resolution *= 2048 / (_resolution * _height);
}
_extent = _appState.Extent;
_extent.Reaspect(_width, _height);
_transform = new AffineTransformation(_width, _height, _extent);
}
开发者ID:ClaireBrill,项目名称:GPV,代码行数:21,代码来源:MapMaker.cs
示例15: XNALogic
internal XNALogic(Application parent, object host, out Microsoft.Xna.Framework.GamerServices.GamerServicesComponent gamerServicesComponent)
{
this.state = new AppState(parent);
this.parent = parent;
parent.UpdateManager.Add(state);
parent.UpdateManager.Add(parent);
gamerServicesComponent = null;
if (host is GameComponentHost)
{
this.xnaGame = new XNAGameComponentHostAppWrapper(this, parent, host as GameComponentHost);
}
else
{
#if !XBOX360
if (host == null)
{
this.xnaGame = new XNAGameAppWrapper(this, parent, out gamerServicesComponent);
}
//else
//{
// WinFormsHostControl _host = host as WinFormsHostControl;
// if (_host != null)
// this.xnaGame = new XNAWinFormsHostAppWrapper(this, parent, _host);
// else
// this.xnaGame = new XNAGameAppWrapper(this, parent, out gamerServicesComponent);
//}
#else
this.xnaGame = new XNAGameAppWrapper(this, parent, out gamerServicesComponent);
#endif
}
this.Exiting += delegate
{
Xen.Graphics.Resource.ClearResourceTracking();
};
}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:39,代码来源:Application.cs
示例16: SetAppState
/// <summary>
/// 设置程序状态
/// </summary>
/// <param name="state"></param>
void SetAppState(AppState state)
{
appState = state;
this.btnStart.Enabled = (appState == AppState.Stoped);
this.btnStop.Enabled = (appState == AppState.Started);
this.txtIpAddress.Enabled = (appState == AppState.Stoped);
this.txtPort.Enabled = (appState == AppState.Stoped);
this.txtDisConn.Enabled = (appState == AppState.Started);
this.btnDisconn.Enabled = (appState == AppState.Started && this.txtDisConn.Text.Length > 0);
}
开发者ID:chengfang0911,项目名称:HP-Socket,代码行数:14,代码来源:frmServer.cs
示例17: BackgroundMediaPlayer_MessageReceivedFromForeground
/// <summary>
/// Raised when a message is recieved from the foreground app
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void BackgroundMediaPlayer_MessageReceivedFromForeground(object sender, MediaPlayerDataReceivedEventArgs e)
{
AppSuspendedMessage appSuspendedMessage;
if (MessageService.TryParseMessage(e.Data, out appSuspendedMessage))
{
Debug.WriteLine("App suspending"); // App is suspended, you can save your task state at this point
foregroundAppState = AppState.Suspended;
var currentTrackId = GetCurrentTrackId();
ApplicationSettingsHelper.SaveSettingsValue(ApplicationSettingsConstants.TrackId, currentTrackId?.ToString());
return;
}
AppResumedMessage appResumedMessage;
if (MessageService.TryParseMessage(e.Data, out appResumedMessage))
{
Debug.WriteLine("App resuming"); // App is resumed, now subscribe to message channel
foregroundAppState = AppState.Active;
return;
}
StartPlaybackMessage startPlaybackMessage;
if (MessageService.TryParseMessage(e.Data, out startPlaybackMessage))
{
//Foreground App process has signalled that it is ready for playback
Debug.WriteLine("Starting Playback");
StartPlayback();
return;
}
SkipNextMessage skipNextMessage;
if (MessageService.TryParseMessage(e.Data, out skipNextMessage))
{
// User has chosen to skip track from app context.
Debug.WriteLine("Skipping to next");
SkipToNext();
return;
}
SkipPreviousMessage skipPreviousMessage;
if (MessageService.TryParseMessage(e.Data, out skipPreviousMessage))
{
// User has chosen to skip track from app context.
Debug.WriteLine("Skipping to previous");
SkipToPrevious();
return;
}
TrackChangedMessage trackChangedMessage;
if (MessageService.TryParseMessage(e.Data, out trackChangedMessage))
{
var index = playbackList.Items.ToList().FindIndex(i => (string)i.Source.CustomProperties[TrackIdKey] == trackChangedMessage.TrackId);
Debug.WriteLine("Skipping to track " + index);
smtc.PlaybackStatus = MediaPlaybackStatus.Changing;
playbackList.MoveTo((uint)index);
return;
}
UpdatePlaylistMessage updatePlaylistMessage;
if (MessageService.TryParseMessage(e.Data, out updatePlaylistMessage))
{
CreatePlaybackList(updatePlaylistMessage.PlayList);
return;
}
}
开发者ID:justijndepover,项目名称:Soundcloudplus,代码行数:69,代码来源:BackgroundAudioTask.cs
示例18: SetAppState
/// <summary>
/// 设置程序状态
/// </summary>
/// <param name="state"></param>
void SetAppState(AppState state)
{
appState = state;
this.btnStart.Enabled = (appState == AppState.Stoped);
this.btnStop.Enabled = (appState == AppState.Started);
this.txtIpAddress.Enabled = (appState == AppState.Stoped);
this.txtPort.Enabled = (appState == AppState.Stoped);
this.cbxAsyncConn.Enabled = (appState == AppState.Stoped);
this.btnSend.Enabled = (appState == AppState.Started);
}
开发者ID:roson9527,项目名称:HP-Socket,代码行数:14,代码来源:frmClient.cs
示例19: Run
/// <summary>
/// The Run method is the entry point of a background task.
/// </summary>
/// <param name="taskInstance"></param>
public void Run(IBackgroundTaskInstance taskInstance)
{
Debug.WriteLine("Background Audio Task " + taskInstance.Task.Name + " starting...");
// Initialize SystemMediaTransportControls (SMTC) for integration with
// the Universal Volume Control (UVC).
//
// The UI for the UVC must update even when the foreground process has been terminated
// and therefore the SMTC is configured and updated from the background task.
smtc = BackgroundMediaPlayer.Current.SystemMediaTransportControls;
smtc.ButtonPressed += smtc_ButtonPressed;
smtc.PropertyChanged += smtc_PropertyChanged;
smtc.IsEnabled = true;
smtc.IsPauseEnabled = true;
smtc.IsPlayEnabled = true;
smtc.IsNextEnabled = true;
smtc.IsPreviousEnabled = true;
// Read persisted state of foreground app
var value = ApplicationSettingsHelper.ReadResetSettingsValue(ApplicationSettingsConstants.AppState);
if (value == null)
foregroundAppState = AppState.Unknown;
else
foregroundAppState = EnumHelper.Parse<AppState>(value.ToString());
// Add handlers for MediaPlayer
BackgroundMediaPlayer.Current.CurrentStateChanged += Current_CurrentStateChanged;
// Initialize message channel
BackgroundMediaPlayer.MessageReceivedFromForeground += BackgroundMediaPlayer_MessageReceivedFromForeground;
// Send information to foreground that background task has been started if app is active
if (foregroundAppState != AppState.Suspended)
MessageService.SendMessageToForeground(new BackgroundAudioTaskStartedMessage());
ApplicationSettingsHelper.SaveSettingsValue(ApplicationSettingsConstants.BackgroundTaskState, BackgroundTaskState.Running.ToString());
deferral = taskInstance.GetDeferral(); // This must be retrieved prior to subscribing to events below which use it
// Mark the background task as started to unblock SMTC Play operation (see related WaitOne on this signal)
backgroundTaskStarted.Set();
smtc.PlaybackStatus = MediaPlaybackStatus.Stopped;
// Associate a cancellation and completed handlers with the background task.
taskInstance.Task.Completed += TaskCompleted;
taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled); // event may raise immediately before continung thread excecution so must be at the end
}
开发者ID:justijndepover,项目名称:Soundcloudplus,代码行数:51,代码来源:BackgroundAudioTask.cs
示例20: ReadNewLocoIOsForm
/// <summary>
/// Default ctor
/// </summary>
internal ReadNewLocoIOsForm(AppState appState)
{
this.appState = appState;
InitializeComponent();
}
开发者ID:chrissharp,项目名称:LoconetToolbox,代码行数:8,代码来源:ReadNewLocoIOsForm.cs
注:本文中的AppState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论