private void InitData() { RequestInfos.Clear(); ReceiveInfos.Clear(); var registryPath = @"SOFTWARE\BIMProduct\BIMProduct2018\Revit2016"; var localMachineRegistry = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32); ClientInfoModel r1 = new ClientInfoModel() { RName = "ProductNameInEng", RValue = RegistryUtils.ReadRegistryInfo(localMachineRegistry, registryPath, "ProductNameInEng") }; ClientInfoModel r2 = new ClientInfoModel() { RName = "RevitVersion", RValue = RegistryUtils.ReadRegistryInfo(localMachineRegistry, registryPath, "RevitVersion") }; ClientInfoModel r3 = new ClientInfoModel() { RName = "ProductVersion", RValue = RegistryUtils.ReadRegistryInfo(localMachineRegistry, registryPath, "ProductVersion") }; RequestInfos.Add(r1); RequestInfos.Add(r2); RequestInfos.Add(r3); }
public AppsPage(string app_id) : base() { var request = RequestInfos.Find(x => x.ID == int.Parse(app_id)); if (request != null) { Device.BeginInvokeOnMainThread(async() => { if (Navigation.NavigationStack.FirstOrDefault(x => x is AppPage) == null) { await Navigation.PushAsync(new AppPage(request)); } }); } }
private void ConnectServer() { try { ClientBasicInfo cb = new ClientBasicInfo() { ProductName = RequestInfos.FirstOrDefault(x => string.Equals(x.RName, "ProductNameInEng", StringComparison.OrdinalIgnoreCase))?.RValue, RevitVersion = RequestInfos.FirstOrDefault(x => string.Equals(x.RName, "RevitVersion", StringComparison.OrdinalIgnoreCase))?.RValue, CurrentProductVersion = RequestInfos.FirstOrDefault(x => string.Equals(x.RName, "ProductVersion", StringComparison.OrdinalIgnoreCase))?.RValue }; ClientInfo = cb; DownloadFileInfo df = new DownloadFileInfo(); var result = RequestInfoUtils.RequestDownloadFileInfo(cb, "http://localhost:55756/", "GetFileInfo", "GetInfo", ref df); DownloadInfo = df; if (result) { ClientInfoModel r1 = new ClientInfoModel() { RName = "LatestProductVersion", RValue = df.LatestProductVersion }; ClientInfoModel r2 = new ClientInfoModel() { RName = "DownloadFileMd5", RValue = df.DownloadFileMd5 }; ClientInfoModel r3 = new ClientInfoModel() { RName = "DownloadFileTotalSize", RValue = df.DownloadFileTotalSize.ToString() }; ReceiveInfos.Add(r1); ReceiveInfos.Add(r2); ReceiveInfos.Add(r3); } else { MessageBox.Show("Get DownLoad File Failed!"); } } catch { MessageBox.Show("Get DownLoad File Failed!"); } }
public AppsPage() { InitializeComponent(); Analytics.TrackEvent("Заявки жителя"); //Settings.MobileSettings.color = null; hex = Color.FromHex(!string.IsNullOrEmpty(Settings.MobileSettings.color) ? Settings.MobileSettings.color : "#FF0000"); BindingContext = viewModel = new AppsPageViewModel(); aIndicator.Color = hex; NavigationPage.SetHasNavigationBar(this, false); MessagingCenter.Subscribe <Object>(this, "AutoUpdate", (sender) => { StartAutoUpdate(); }); MessagingCenter.Subscribe <Object>(this, "StartRefresh", (sender) => { Device.BeginInvokeOnMainThread(() => aIndicator.IsVisible = true); }); MessagingCenter.Subscribe <Object>(this, "EndRefresh", (sender) => { Device.BeginInvokeOnMainThread(() => aIndicator.IsVisible = false); }); var goAddIdent = new TapGestureRecognizer(); goAddIdent.Tapped += async(s, e) => { /*await Dialog.Instance.ShowAsync<AddAccountDialogView>();*/ if (Navigation.NavigationStack.FirstOrDefault(x => x is AddIdent) == null) { await Navigation.PushAsync(new AddIdent((PaysPage)Settings.mainPage)); } }; StackLayoutIdent.GestureRecognizers.Add(goAddIdent); switch (Device.RuntimePlatform) { case Device.iOS: int statusBarHeight = DependencyService.Get <IStatusBar>().GetHeight(); Pancake.Padding = new Thickness(0, statusBarHeight, 0, 0); //хак чтобы список растягивался на все необходимое пространоство. а так //есть баг в xamarin, потому что fillAndExpand не работает(https://github.com/xamarin/Xamarin.Forms/issues/6908) additionalList.HeightRequest = 3000; if (Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Width < 700) { LabelSwitch.FontSize = 12; } FrameBtnAdd.IsVisible = false; FrameBtnAddIos.IsVisible = true; break; case Device.Android: FrameBtnAdd.IsVisible = true; FrameBtnAddIos.IsVisible = false; break; default: break; } var profile = new TapGestureRecognizer(); profile.Tapped += async(s, e) => { if (Navigation.NavigationStack.FirstOrDefault(x => x is ProfilePage) == null) { await Navigation.PushAsync(new ProfilePage()); } }; IconViewProfile.GestureRecognizers.Add(profile); var techSend = new TapGestureRecognizer(); techSend.Tapped += async(s, e) => { await Navigation.PushAsync(new Tech.AppPage()); }; LabelTech.GestureRecognizers.Add(techSend); var call = new TapGestureRecognizer(); call.Tapped += async(s, e) => { if (Settings.Person.Phone != null) { IPhoneCallTask phoneDialer; phoneDialer = CrossMessaging.Current.PhoneDialer; if (phoneDialer.CanMakePhoneCall && !string.IsNullOrWhiteSpace(Settings.Person.companyPhone)) { phoneDialer.MakePhoneCall( System.Text.RegularExpressions.Regex.Replace(Settings.Person.companyPhone, "[^+0-9]", "")); } } }; var addClick = new TapGestureRecognizer(); addClick.Tapped += async(s, e) => { startNewApp(FrameBtnAdd, null); }; FrameBtnAdd.GestureRecognizers.Add(addClick); var addClickIOS = new TapGestureRecognizer(); addClickIOS.Tapped += async(s, e) => { startNewApp(FrameBtnAddIos, null); }; FrameBtnAddIos.GestureRecognizers.Add(addClickIOS); SetText(); //getApps(); additionalList.BackgroundColor = Color.Transparent; additionalList.Effects.Add(Effect.Resolve("MyEffects.ListViewHighlightEffect")); this.CancellationTokenSource = new CancellationTokenSource(); MessagingCenter.Subscribe <Object>(this, "UpdateAppCons", (sender) => RefreshData()); MessagingCenter.Subscribe <Object, int>(this, "CloseAPP", async(sender, args) => { await RefreshData(); var request = RequestInfos?.Find(x => x.ID == args); if (request != null) { try { CancellationTokenSource.Cancel(); CancellationTokenSource.Dispose(); } catch { } Device.BeginInvokeOnMainThread(async() => { if (Navigation.NavigationStack.FirstOrDefault(x => x is AppPage) == null) { await Navigation.PushAsync(new AppPage(request)); } }); } }); viewModel.LoadRequests.Execute(null); // PropertyChanged = "change" SwitchApp.Toggled += SwitchApp_Toggled; MessagingCenter.Subscribe <Object>(this, "ChangeThemeCounter", (sender) => { OSAppTheme currentTheme = Application.Current.RequestedTheme; var colors = new Dictionary <string, string>(); var arrowcolor = new Dictionary <string, string>(); if (currentTheme == OSAppTheme.Light || currentTheme == OSAppTheme.Unspecified) { colors.Add("#000000", ((Color)Application.Current.Resources["MainColor"]).ToHex()); arrowcolor.Add("#000000", "#494949"); } else { colors.Add("#000000", "#FFFFFF"); arrowcolor.Add("#000000", "#FFFFFF"); } //IconViewTech.ReplaceStringMap = colors; }); MessagingCenter.Subscribe <Object, int>(this, "OpenApp", async(sender, index) => { await viewModel.UpdateTask(); //if (Device.RuntimePlatform == Device.iOS) // if (viewModel.Empty) // { // Device.BeginInvokeOnMainThread(() => additionalList.HeightRequest = -1); // } // else // { // Device.BeginInvokeOnMainThread(() => additionalList.HeightRequest = 3000); // } while (viewModel.AllRequests == null) { await Task.Delay(TimeSpan.FromMilliseconds(50)); } var request = viewModel.AllRequests.Where(x => x.ID == index).ToList(); if (request != null && request.Count > 0) { Device.BeginInvokeOnMainThread(async() => { if (Navigation.NavigationStack.FirstOrDefault(x => x is AppPage) == null) { await Navigation.PushAsync(new AppPage(request[0], false, request[0].IsPaid)); } }); } }); MessagingCenter.Subscribe <Object, string>(this, "RemoveIdent", (sender, args) => { if (args == null) { viewModel.Requests.Clear(); } }); }