本文整理汇总了C#中AppState类的典型用法代码示例。如果您正苦于以下问题:C# AppState类的具体用法?C# AppState怎么用?C# AppState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AppState类属于命名空间,在下文中一共展示了AppState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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"];
}
}
}
示例4: startButton_Click
private void startButton_Click(object sender, EventArgs e)
{
endTime = DateTime.Now.AddMinutes(20);
timer.Start();
appState = AppState.Running;
UpdateTexts();
}
示例5: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
appState = AppState.Initial;
timer.Interval = 1000;
timer.Tick += timer_Tick;
UpdateTexts();
}
示例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;
}
示例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;
}
示例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);
}
示例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";
}
}
}
示例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();
}
示例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;
}
示例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());
}
}
示例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;
}
}
示例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);
}
示例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();
};
}