public ContactsViewModel(MegaSDK megaSdk, AppInformation appInformation, ContactsPage contactsPage) : base(megaSdk, appInformation) { _contactsPage = contactsPage; ReinviteRequestCommand = new DelegateCommand(ReinviteRequest); DeleteRequestCommand = new DelegateCommand(DeleteRequest); AcceptRequestCommand = new DelegateCommand(AcceptRequest); IgnoreRequestCommand = new DelegateCommand(IgnoreRequest); DeclineRequestCommand = new DelegateCommand(DeclineRequest); ViewContactCommand = new DelegateCommand(ViewContact); DeleteContactCommand = new DelegateCommand(DeleteContact); UpdateUserData(); InitializeMenu(HamburgerMenuItemType.Contacts); SetEmptyContentTemplate(true); MegaContactsSortMode = ListSortMode.Ascending; MultiSelectCheckBoxStyle = (Style)Application.Current.Resources["DefaultCheckBoxStyle"]; MegaContactsList = new ObservableCollection <Contact>(); MegaContactsList.CollectionChanged += MegaContacts_CollectionChanged; CreateContactsGroupDescriptors(); CreateContactSortDescriptors(); ReceivedContactRequests = new ObservableCollection <ContactRequest>(); ReceivedContactRequests.CollectionChanged += ReceivedContactRequests_CollectionChanged; SentContactRequests = new ObservableCollection <ContactRequest>(); SentContactRequests.CollectionChanged += SentContactRequests_CollectionChanged; }
// GET: Home public ActionResult Index() { var appInfo = new AppInformation(); ViewBag.Message = appInfo; return(View()); }
public CameraUploadsViewModel(MegaSDK megaSdk, AppInformation appInformation) : base(megaSdk, appInformation) { UpdateUserData(); InitializeMenu(HamburgerMenuItemType.CameraUploads); }
public ImageNodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, FolderViewModel parent, ObservableCollection <IBaseNode> parentCollection = null, ObservableCollection <IBaseNode> childCollection = null) : base(megaSdk, appInformation, megaNode, parent, parentCollection, childCollection) { // Default false for preview slide InViewingRange = false; }
public static List <NodeViewModel> GetRecursiveNodes(MegaSDK megaSdk, AppInformation appInformation, FolderNodeViewModel folderNode) { var result = new List <NodeViewModel>(); var childNodeList = megaSdk.getChildren(folderNode.OriginalMNode); // Retrieve the size of the list to save time in the loops int listSize = childNodeList.size(); for (int i = 0; i < listSize; i++) { // To avoid pass null values to CreateNew if (childNodeList.get(i) == null) { continue; } var node = CreateNew(megaSdk, appInformation, childNodeList.get(i), folderNode.Parent); var folder = node as FolderNodeViewModel; if (folder != null) { result.AddRange(GetRecursiveNodes(megaSdk, appInformation, folder)); } else { result.Add(node); } } return(result); }
public FileNodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, ContainerType parentContainerType, ObservableCollection <IMegaNode> parentCollection = null, ObservableCollection <IMegaNode> childCollection = null) : base(megaSdk, appInformation, megaNode, parentContainerType, parentCollection, childCollection) { this.Information = this.Size.ToStringAndSuffix(2); this.Transfer = new TransferObjectModel(MegaSdk, this, MTransferType.TYPE_DOWNLOAD, LocalFilePath); }
protected async override void OnLaunched(LaunchActivatedEventArgs args) { var stopwatch = new Stopwatch(); stopwatch.Start(); await InitializeLogger(); Logger.Current.Line("================================="); Logger.Current.Info($"Version: {AppInformation.GetVersion()}"); Logger.Current.Info($"Arguments: \"{args.Arguments}\""); Logger.Current.Info($"Launch reason: {args.Kind}"); Logger.Current.Info($"Tile ID: {args.TileId}"); Logger.Current.Info($"Previous state: {args.PreviousExecutionState}"); await InitializeBackgroundTasks(); InitializeColors(); InitializeTitleBar(); await InitializeStatusBar(); ShowContent(); stopwatch.Stop(); Logger.Current.Info($"Launch time: {stopwatch.Elapsed}"); }
public FolderViewModel(MegaSDK megaSdk, AppInformation appInformation, ContainerType containerType) : base(megaSdk, appInformation) { this.Type = containerType; this.FolderRootNode = null; this.IsBusy = false; this.BusyText = null; this.ChildNodes = new ObservableCollection <IMegaNode>(); this.BreadCrumbs = new ObservableCollection <IBaseNode>(); this.BreadCrumbs.CollectionChanged += BreadCrumbs_CollectionChanged; this.SelectedNodes = new List <IMegaNode>(); this.IsMultiSelectActive = false; this.RemoveItemCommand = new DelegateCommand(this.RemoveItem); this.RenameItemCommand = new DelegateCommand(this.RenameItem); this.DownloadItemCommand = new DelegateCommand(this.DownloadItem); this.ImportItemCommand = new DelegateCommand(this.ImportItem); this.CreateShortCutCommand = new DelegateCommand(this.CreateShortCut); this.ChangeViewCommand = new DelegateCommand(this.ChangeView); this.GetLinkCommand = new DelegateCommand(this.GetLink); this.MultiSelectCommand = new DelegateCommand(this.MultiSelect); this.ViewDetailsCommand = new DelegateCommand(this.ViewDetails); this.ChildNodes.CollectionChanged += ChildNodes_CollectionChanged; SetViewDefaults(); SetEmptyContentTemplate(true); switch (containerType) { case ContainerType.CloudDrive: this.CurrentDisplayMode = DriveDisplayMode.CloudDrive; break; case ContainerType.RubbishBin: this.CurrentDisplayMode = DriveDisplayMode.RubbishBin; break; case ContainerType.InShares: this.CurrentDisplayMode = DriveDisplayMode.InShares; break; case ContainerType.OutShares: this.CurrentDisplayMode = DriveDisplayMode.OutShares; break; case ContainerType.ContactInShares: this.CurrentDisplayMode = DriveDisplayMode.ContactInShares; break; case ContainerType.FolderLink: this.CurrentDisplayMode = DriveDisplayMode.FolderLink; break; default: throw new ArgumentOutOfRangeException("containerType"); } }
public SettingsViewModel(MegaSDK megaSdk, AppInformation appInformation) : base(megaSdk, appInformation) { this.ShareRecoveryKeyCommand = new DelegateCommand(ShareRecoveryKey); this.CopyRecoveryKeyCommand = new DelegateCommand(CopyRecoveryKey); this.ChangePinLockCommand = new DelegateCommand(ChangePinLock); this.ViewRecoveryKeyCommand = new DelegateCommand(ViewRecoveryKey); this.CloseOtherSessionsCommand = new DelegateCommand(CloseOtherSessions); this.ClearCacheCommand = new DelegateCommand(ClearCache); #if WINDOWS_PHONE_80 this.SelectDownloadLocationCommand = null; #elif WINDOWS_PHONE_81 this.SelectDownloadLocationCommand = new DelegateCommand(SelectDownloadLocation); #endif this.MegaSdkCommand = new DelegateCommand(NavigateToMegaSdk); this.GoedWareCommand = new DelegateCommand(NavigateToGoedWare); this.TermsOfServiceCommand = new DelegateCommand(NavigateToTermsOfService); this.PrivacyPolicyCommand = new DelegateCommand(NavigateToPrivacyPolicy); this.CopyrightCommand = new DelegateCommand(NavigateToCopyright); this.TakedownGuidanceCommand = new DelegateCommand(NavigateToTakedownGuidance); this.GeneralCommand = new DelegateCommand(NavigateToGeneral); this.DataProtectionRegulationCommand = new DelegateCommand(NavigateToDataProtectionRegulation); this.Initialize(); UpdateUserData(); InitializeMenu(HamburgerMenuItemType.Settings); AccountDetails.GetAppCacheSize(); }
public GlobalListener(AppInformation appInformation) { _appInformation = appInformation; this.Nodes = new List <NodeDetailsViewModel>(); this.Folders = new List <FolderViewModel>(); this.Contacts = new List <ContactsViewModel>(); this.ContactsDetails = new List <ContactDetailsViewModel>(); }
public FolderLinkViewModel(MegaSDK megaSdk, AppInformation appInformation, FolderLinkPage folderLinkPage) : base(megaSdk) { this._folderLinkPage = folderLinkPage; InitializeModel(); }
public MyAccountPageViewModel(MegaSDK megaSdk, AppInformation appInformation) : base(megaSdk, appInformation) { InitializeMenu(HamburgerMenuItemType.MyAccount); UpdateUserData(); IsAccountUpdate = false; }
public FolderNodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, FolderViewModel parent, ObservableCollection <IBaseNode> parentCollection = null, ObservableCollection <IBaseNode> childCollection = null) : base(megaSdk, appInformation, megaNode, parent, parentCollection, childCollection) { this.ShareCommand = new RelayCommand(Share); this.RemoveSharedAccessCommand = new RelayCommand(RemoveSharedAccess); this.Update(megaNode); }
public SharedItemsViewModel(MegaSDK megaSdk, AppInformation appInformation) : base(megaSdk, appInformation) { UpdateUserData(); InitializeModel(); InitializeMenu(HamburgerMenuItemType.SharedItems); }
protected override void CreateModel() { _GeneralSettings = new GeneralSettings(); _PrivacySettings = new PrivacySettings(); _PlaybackSettings = new PlaybackSettings(); _SubtitleSettings = new SubtitleSettings(); _FontSettings = new FontSettings(); _AppInformation = new AppInformation(); }
public ContactDetailsViewModel(MegaSDK megaSdk, AppInformation appInformation) : base(megaSdk, appInformation) { UpdateUserData(); InitializeMenu(HamburgerMenuItemType.Contacts); this.InShares = new FolderViewModel(this.MegaSdk, this.AppInformation, ContainerType.ContactInShares); }
protected NodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, ContainerType parentContainerType, ObservableCollection <IMegaNode> parentCollection = null, ObservableCollection <IMegaNode> childCollection = null) : base(megaSdk, appInformation) { Update(megaNode, parentContainerType); SetDefaultValues(); this.ParentCollection = parentCollection; this.ChildCollection = childCollection; }
public AppDataMessage(Guid guid, String name, String shortname, DateTime startedAt, AppVersion version, AppInformation information, AppStatus status, AppBranch branch) { Guid = guid; AppName = name; AppShortName = shortname; StartedAt = startedAt; Version = version; Information = information; Status = status; Branch = branch; }
public TransfersViewModel(MegaSDK megaSdk, AppInformation appInformation, TransferQueu megaTransfers) : base(megaSdk, appInformation) { MegaTransfers = megaTransfers; UpdateUserData(); InitializeMenu(HamburgerMenuItemType.Transfers); SetEmptyContentTemplate(); }
public ImageNodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, ContainerType parentContainerType, ObservableCollection <IMegaNode> parentCollection = null, ObservableCollection <IMegaNode> childCollection = null) : base(megaSdk, appInformation, megaNode, parentContainerType, parentCollection, childCollection) { // Image node downloads to the image path of the full original image this.Transfer = new TransferObjectModel(MegaSdk, this, MTransferType.TYPE_DOWNLOAD, LocalFilePath); this.DefaultImagePathData = ImageService.GetDefaultFileTypePathData(this.Name); // Default false for preview slide InViewingRange = false; }
public IActionResult AddoUpdate(AppInformation model) { //待返回对象 var result = new ResponseModel(ResponseCode.Error, "保存应用信息失败!"); var row = 0; try { var datetime = DateTime.Now; //新增应用信息 if (string.IsNullOrEmpty(model.appid)) { //生成公钥,私钥 RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); model.公钥 = Convert.ToBase64String(rsa.ExportCspBlob(false)); model.私钥 = Convert.ToBase64String(rsa.ExportCspBlob(true)); model.appid = string.Format("{0:yyyyMMddHHmmssf}", datetime); //判断appid是否存在 var appinfo = this.Query <AppInformation>().Where("appid", model.appid).Exists(); if (appinfo) { result.msg = "appid重复,请重新保存!"; return(Json(result)); } model.数据标识 = 1; model.登记人id = loginUser.id; model.登记时间 = datetime; row = this.Add(model).Execute(); } //修改 else { //修改变更人,变更时间 model.变更人id = loginUser.id; model.变更时间 = DateTime.Now; row = this.Update(model).Columns("应用名称", "应用状态", "变更时间", "变更人id", "使用平台", "产品id", "有效期") .Where("appid", model.appid).Execute(); } if (row > 0) { result.msg = "保存应用信息成功!"; result.code = (int)ResponseCode.Error; } } catch (Exception ex) { LogError("保存应用信息失败", ex); result.code = (int)ResponseCode.Error; result.msg = "服务器内部异常"; } return(Json(result)); }
public TransfersViewModel(MegaSDK megaSdk, AppInformation appInformation) : base(megaSdk, appInformation) { UpdateUserData(); InitializeMenu(HamburgerMenuItemType.Transfers); this.Downloads = new TransferListViewModel(MTransferType.TYPE_DOWNLOAD); this.Uploads = new TransferListViewModel(MTransferType.TYPE_UPLOAD); this.Completed = new TransferListViewModel(); this.ActiveViewModel = this.Downloads; }
public MainPageViewModel(MegaSDK megaSdk, AppInformation appInformation, MainPage mainPage) : base(megaSdk, appInformation) { _mainPage = mainPage; UpgradeAccountCommand = new DelegateCommand(UpgradeAccount); CancelUpgradeAccountCommand = new DelegateCommand(CancelUpgradeAccount); InitializeModel(); UpdateUserData(); InitializeMenu(HamburgerMenuItemType.CloudDrive); }
public static async Task Main(string[] args) { try { var appInfo = new AppInformation { AppExecutableName = "AutoUpdater.Wpf.Test.exe", AppVersionFolderNamePrefix = "AutoUpdater.Wpf.Test" }; appInfo.CheckAndFix(); var uri = new Uri("https://raw.githubusercontent.com/thudugala/AutoUpdater.NET/master/Mohio.Setup.Test/UpdateInformation.json"); Installer.Instance.UpdateInfoWebRequest = WebRequest.Create(uri); Installer.Instance.DownloadWebClient = new WebClient(); try { await Installer.Instance.DownloadApp(appInfo); } catch (Exception ex) { Logger.Instance.TrackError(ex); } try { Installer.RunApp(new ProcessStartInfo(), appInfo); } catch (Exception ex) { Logger.Instance.TrackError(ex); } try { await Installer.Instance.WaitNewAppVerionToFinishDownload(); } catch (Exception ex) { Logger.Instance.TrackError(ex); } } catch (Exception ex) { Logger.Instance.TrackError(ex); } finally { Logger.Instance.WriteLog(); } }
public MyAccountPageViewModel(MegaSDK megaSdk, AppInformation appInformation, MyAccountPage myAccountPage) : base(megaSdk, appInformation) { InitializeMenu(HamburgerMenuItemType.MyAccount); UpdateUserData(); AccountDetails = new AccountDetailsViewModel(myAccountPage) { UserEmail = megaSdk.getMyEmail() }; UpgradeAccount = new UpgradeAccountViewModel(); IsAccountUpdate = false; }
public FolderNodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, ContainerType parentContainerType, ObservableCollection<IMegaNode> parentCollection = null, ObservableCollection<IMegaNode> childCollection = null) : base(megaSdk, appInformation, megaNode, parentContainerType, parentCollection, childCollection) { SetFolderInfo(); this.IsDefaultImage = true; this.DefaultImagePathData = VisualResources.FolderTypePath_default; if (megaSdk.isShared(megaNode)) this.DefaultImagePathData = VisualResources.FolderTypePath_shared; if (!megaNode.getName().ToLower().Equals("camera uploads")) return; this.DefaultImagePathData = VisualResources.FolderTypePath_photo; }
public SettingsViewModel(MegaSDK megaSdk, AppInformation appInformation) : base(megaSdk, appInformation) { this.AppVersion = AppService.GetAppVersion(); this.MegaSdkVersion = AppService.GetMegaSDK_Version(); this.ShareRecoveryKeyCommand = new DelegateCommand(ShareRecoveryKey); this.CopyRecoveryKeyCommand = new DelegateCommand(CopyRecoveryKey); this.ChangePinLockCommand = new DelegateCommand(ChangePinLock); this.ViewRecoveryKeyCommand = new DelegateCommand(ViewRecoveryKey); #if WINDOWS_PHONE_80 this.SelectDownloadLocationCommand = null; #elif WINDOWS_PHONE_81 this.SelectDownloadLocationCommand = new DelegateCommand(SelectDownloadLocation); #endif this.MegaSdkCommand = new DelegateCommand(NavigateToMegaSdk); this.GoedWareCommand = new DelegateCommand(NavigateToGoedWare); this.TermsOfServiceCommand = new DelegateCommand(NavigateToTermsOfService); this.PrivacyPolicyCommand = new DelegateCommand(NavigateToPrivacyPolicy); this.CopyrightCommand = new DelegateCommand(NavigateToCopyright); this.TakedownGuidanceCommand = new DelegateCommand(NavigateToTakedownGuidance); this.GeneralCommand = new DelegateCommand(NavigateToGeneral); this.DataProtectionRegulationCommand = new DelegateCommand(NavigateToDataProtectionRegulation); this.PinLockIsEnabled = SettingsService.LoadSetting <bool>(SettingsResources.UserPinLockIsEnabled, false); // Do not set the property on initialize, because it fill fire the SetAutoCameraUploadStatus _cameraUploadsIsEnabled = MediaService.GetAutoCameraUploadStatus(); this.CameraUploadsIsEnabledText = _cameraUploadsIsEnabled ? UiResources.On : UiResources.Off; #if WINDOWS_PHONE_80 this.ExportIsEnabled = SettingsService.LoadSetting <bool>(SettingsResources.ExportImagesToPhotoAlbum, false); #elif WINDOWS_PHONE_81 this.AskDownloadLocationIsEnabled = SettingsService.LoadSetting <bool>(SettingsResources.AskDownloadLocationIsEnabled, false); this.StandardDownloadLocation = SettingsService.LoadSetting <string>( SettingsResources.DefaultDownloadLocation, UiResources.DefaultDownloadLocation); #endif UpdateUserData(); InitializeMenu(HamburgerMenuItemType.Settings); }
private void InitializeApplication() { if (ApplicationInitialized) { return; } // Clear settings values we do no longer use AppService.ClearObsoleteSettings(); // Initialize the application information if (AppInformation == null) { AppInformation = new AppInformation(); } // Initialize the links information LinkInformationService.Reset(); // Initialize SDK parameters SdkService.InitializeSdkParams(); // Add a global notifications listener GlobalListener = new GlobalListener(); SdkService.MegaSdk.addGlobalListener(GlobalListener); // Add a global request listener to process all. SdkService.MegaSdk.addRequestListener(this); // Add a global transfer listener to process all transfers. SdkService.MegaSdk.addTransferListener(TransferService.GlobalTransferListener); // Initialize Folders AppService.InitializeAppFolders(); // Initialize the DB AppService.InitializeDatabase(); // Save the app information for future use (like deleting settings) AppService.SaveAppInformation(); // Ensure we don't initialize again ApplicationInitialized = true; }
public static NodeViewModel CreateNew(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, ContainerType parentContainerType, ObservableCollection <IMegaNode> parentCollection = null, ObservableCollection <IMegaNode> childCollection = null) { if (megaNode == null) { return(null); } try { switch (megaNode.getType()) { case MNodeType.TYPE_UNKNOWN: break; case MNodeType.TYPE_FILE: { if (megaNode.hasThumbnail() || megaNode.hasPreview() || ImageService.IsImage(megaNode.getName())) { return(new ImageNodeViewModel(megaSdk, appInformation, megaNode, parentContainerType, parentCollection, childCollection)); } return(new FileNodeViewModel(megaSdk, appInformation, megaNode, parentContainerType, parentCollection, childCollection)); } case MNodeType.TYPE_FOLDER: case MNodeType.TYPE_ROOT: case MNodeType.TYPE_RUBBISH: { return(new FolderNodeViewModel(megaSdk, appInformation, megaNode, parentContainerType, parentCollection, childCollection)); } case MNodeType.TYPE_INCOMING: break; } } catch (Exception) { return(null); } return(null); }
public CloudDriveViewModel(MegaSDK megaSdk, AppInformation appInformation) : base(megaSdk, appInformation) { //this.DriveDisplayMode = DriveDisplayMode.CloudDrive; this.CurrentRootNode = null; //this.BreadCrumbNode = null; //this.ChildNodes = new ObservableCollection<IMegaNode>(); //this.BreadCrumbs = new ObservableCollection<IMegaNode>(); //this.SelectedNodes = new List<IMegaNode>(); //this.IsMultiSelectActive = false; //SetViewDefaults(); //this.RemoveItemCommand = new DelegateCommand(this.RemoveItem); //this.RenameItemCommand = new DelegateCommand(this.RenameItem); //this.GetPreviewLinkItemCommand = new DelegateCommand(this.GetPreviewLink); //this.DownloadItemCommand = new DelegateCommand(this.DownloadItem); //this.CreateShortCutCommand = new DelegateCommand(this.CreateShortCut); //this.ChangeViewCommand = new DelegateCommand(this.ChangeView); //this.MultiSelectCommand = new DelegateCommand(this.MultiSelect); //this.UpgradeAccountCommand = new DelegateCommand(this.UpgradeAccount); }