private static void ConnexionMessageHandlerProcImpl(UInt32 connection, UInt32 messageType, IntPtr messageArgument) { //Debug.Log("Connexion Message: " + connection + "; messageType=" + messageType.ToString("X")); switch (messageType) { case ConnexionClient.kConnexionMsgDeviceState: try { ConnexionDeviceState ds = (ConnexionDeviceState)Marshal.PtrToStructure(messageArgument, typeof(ConnexionDeviceState)); SubInstance.ConnexionDeviceStateChanged(ref ds); } catch (Exception e) { Debug.LogError(e); } break; case ConnexionClient.kConnexionMsgPrefsChanged: // TODO NOT IMPLEMENTED break; default: // Other messages should be ignored by the client break; } }
// Collection private void Button_Click_Change_Collection(object sender, RoutedEventArgs e) { var item = new SubInstance() { Field = RandomGuid() }; database.SubDatabase.Collection.Add(item); }
private void ConnexionRemoved() { SubInstance.ResetAll(); }
private void ConnexionAdded() { SubInstance.ResetAll(); }
private static void ConnexionRemovedHandlerProcImpl(UInt32 connection) { SubInstance.ConnexionRemoved(); }
private void ScavengeAppsOverQuota(SubInstance[] subs, int deploysToScavenge, out bool appExcluded) { appExcluded = false; DateTime time = DateTime.UtcNow - Constants.OnlineAppScavengingGracePeriod; using (ComponentStore.StoreTransactionContext context = new ComponentStore.StoreTransactionContext(this._compStore)) { for (int i = subs.Length - 1; (i >= 0) && (deploysToScavenge > 0); i--) { bool flag = false; bool flag2 = false; if (subs[i].SubState.PreviousBind != null) { if (subs[i].LastAccessTime >= time) { appExcluded = true; } else { flag = true; } deploysToScavenge--; } if (deploysToScavenge > 0) { if (subs[i].LastAccessTime >= time) { appExcluded = true; } else { flag2 = true; } deploysToScavenge--; } if (flag2 || flag) { SubscriptionStateInternal newState = new SubscriptionStateInternal(subs[i].SubState); if (flag2) { newState.IsInstalled = false; } else { newState.PreviousBind = null; } this._compStore.PrepareFinalizeSubscriptionState(context, subs[i].SubState, newState); } } this._compStore.SubmitStoreTransaction(context, null); } }
private SubInstance[] CollectOnlineAppsMRU(out System.Deployment.Internal.Isolation.IDefinitionAppId[] deployAppIdPtrs) { Hashtable hashtable = new Hashtable(); foreach (System.Deployment.Internal.Isolation.STORE_ASSEMBLY store_assembly in this._compStore._store.EnumAssemblies(System.Deployment.Internal.Isolation.Store.EnumAssembliesFlags.Nothing)) { System.Deployment.Application.DefinitionIdentity subId = new System.Deployment.Application.DefinitionIdentity(store_assembly.DefinitionIdentity).ToSubscriptionId(); SubscriptionState subscriptionState = this._compStore._subStore.GetSubscriptionState(subId); if ((subscriptionState.IsInstalled && !subscriptionState.IsShellVisible) && ((subscriptionState.appType != AppType.CustomHostSpecified) && !hashtable.Contains(subId))) { SubInstance instance = new SubInstance { SubState = subscriptionState, LastAccessTime = subscriptionState.LastCheckTime }; hashtable.Add(subId, instance); } } SubInstance[] array = new SubInstance[hashtable.Count]; hashtable.Values.CopyTo(array, 0); Array.Sort<SubInstance>(array); ArrayList list = new ArrayList(); for (int i = 0; i < array.Length; i++) { if (array[i].SubState.CurrentBind != null) { list.Add(array[i].SubState.CurrentBind.ToDeploymentAppId().ComPointer); } if (array[i].SubState.PreviousBind != null) { list.Add(array[i].SubState.PreviousBind.ToDeploymentAppId().ComPointer); } } deployAppIdPtrs = (System.Deployment.Internal.Isolation.IDefinitionAppId[]) list.ToArray(typeof(System.Deployment.Internal.Isolation.IDefinitionAppId)); return array; }