private async void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e) { switch (e.StatusType) { case GestureStatus.Running: // Translate and ensure we don't pan beyond the wrapped user interface element bounds. if (Math.Abs(e.TotalX) > Math.Abs(e.TotalY) && MainGrid.TranslationY == 0) { MainGrid.TranslationX = Math.Min(MainGrid.TranslationX + e.TotalX, Application.Current.MainPage.Width); MainGrid1.TranslationX = Math.Min(MainGrid1.TranslationX + e.TotalX, Application.Current.MainPage.Width); MainGrid2.TranslationX = Math.Max(MainGrid2.TranslationX + e.TotalX, 0); //Content.TranslationY = // Math.Max(Math.Min(0, y + e.TotalY), -Math.Abs(Content.Height - App.ScreenHeight)); break; } else if (MainGrid.TranslationX == 0 && e.TotalY < 0) { MainGrid.TranslationY = Math.Max(MainGrid.TranslationY + e.TotalY, -Application.Current.MainPage.Height); break; } break; case GestureStatus.Completed: // Store the translation applied during the pan if (-MainGrid.TranslationX > (Application.Current.MainPage.Width / 2) && (MainGrid.TranslationX < 0)) { NextTapped(null, null); TranslateOriginal(); } else if (MainGrid.TranslationX > (HalfWidth)) { PlayPreviousitem(); TranslateOriginal(); } else if (-MainGrid.TranslationY > App.Current.MainPage.Height / 4) { MainGrid.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height); await ControlsLayout.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height); UpSvg.RotateTo(180); MainCollectionView.Margin = new Thickness(0, ControlsLayout.Height, 0, 0); MainCollectionView.IsVisible = true; //CollectionStack.TranslateTo(0,-((ControlsLayout.Height) - App.Current.MainPage.Height)); } else { TranslateOriginalAnimate(); } break; } }
public SettingsData() { audioActive = true; showFPS = false; controlsLayout = ControlsLayout.JOYSTICK_RIGHT; cameraLookAt = false; hudConf = EndlessModeHUD.DISTANCE; qualityLevel = 2; }
public async void TapGestureRecognizer_Tapped(object sender, EventArgs e) { if (MainCollectionView.IsVisible == true) { TranslateOriginal(); } else { MainGrid.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height); await ControlsLayout.TranslateTo(0, ControlsLayout.Height - App.Current.MainPage.Height); UpSvg.RotateTo(180); MainCollectionView.Margin = new Thickness(0, ControlsLayout.Height, 0, 0); MainCollectionView.IsVisible = true; } }
public ProductLayout(string productName, string layoutName, ControlsLayout controlLayout) { errorMsg = ""; try { this.productName = productName; if (layoutName == typeof(ProductLayout1).Name) { productLayout = new ProductLayout1(controlLayout); } else if (layoutName == typeof(ProductLayout2).Name) { productLayout = new ProductLayout2(controlLayout); } else if (layoutName == typeof(ProductLayout3).Name) { productLayout = new ProductLayout3(controlLayout); } else if (layoutName == typeof(ProductLayout4).Name) { productLayout = new ProductLayout4(controlLayout); } else if (layoutName == typeof(ProductLayout5).Name) { productLayout = new ProductLayout5(controlLayout); } else if (layoutName == typeof(ProductLayout6).Name) { productLayout = new ProductLayout6(controlLayout); } } catch (System.Exception e) { errorMsg = "Initializing product layout of " + productName + " failed with error: " + e.Message; #if DEBUG Logger.GetLogger().Error(errorMsg); #endif } finally { if (string.IsNullOrEmpty(errorMsg) && productLayout == null) { errorMsg = "No product with name " + productName; } } }
public ProductLayout4(ControlsLayout controlsLayout) { InitializeComponent(); Color FontColor = ConfigParser.GetConfig().GetColorValue("//Main/FormDesign/FontColor"); if (FontColor != null) { txtDisclaimer.ForeColor = FontColor; txtTitle.ForeColor = FontColor; txtDescription.ForeColor = FontColor; } controlsLayout.SetLayout(pnlLayout.Controls); Dock = DockStyle.Fill; }
private async void TranslateOriginal() { MainGrid.IsVisible = false; MainCollectionView.FadeTo(0); MainCollectionView.IsVisible = false; MainCollectionView.FadeTo(1); MainGrid.TranslationX = 0; MainGrid.TranslateTo(0, 0); ControlsLayout.TranslateTo(0, 0); bool c = await AwaiterF(); MainGrid.IsVisible = true; MainGrid2.TranslationX = Application.Current.MainPage.Width; MainGrid1.TranslationX = -(Application.Current.MainPage.Width); //CollectionStack.TranslationY = Application.Current.MainPage.Height; }
private ProductSettings ExtractProductSettings(XmlNode productSettingsNode) { #if DEBUG Logger.GetLogger().Info("Read config file - Product Settings:", Logger.Level.MEDIUM_DEBUG_LEVEL); #endif ProductSettings productSettings = new ProductSettings { IsOptional = XmlParser.GetBoolAttribute(productSettingsNode, "optional"), IsExtractable = XmlParser.GetBoolAttribute(productSettingsNode, "extractable", true), Exclusive = XmlParser.GetBoolAttribute(productSettingsNode, "exclusive", false) }; string guid = XmlParser.GetStringValue(productSettingsNode, "Guid"); if (string.IsNullOrEmpty(guid)) { guid = Guid.NewGuid().ToString(); XmlParser.SetStringValue(_xmlDoc, productSettingsNode, "Guid", guid); } productSettings.Guid = guid; XmlNode productStaticData = productSettingsNode.SelectSingleNode("StaticData"); XmlNode productDynamicData = productSettingsNode.SelectSingleNode("DynamicData"); productSettings.Name = XmlParser.GetStringValue(productStaticData, "Title"); if (productSettings.IsOptional) { productSettings.Name = XmlParser.GetStringValue(productDynamicData, "InternalName"); } productSettings.Class = XmlParser.GetStringValue(productDynamicData, "Class"); EvalCustomVariables(productStaticData.SelectSingleNode("CustomData/CustomVars")); productSettings.Filename = XmlParser.GetStringValue(productStaticData, "Filename"); productSettings.ExtractPath = XmlParser.GetStringValue(productStaticData, "ExtractPath"); productSettings.RunPath = XmlParser.GetStringValue(productStaticData, "RunPath"); productSettings.DownloadURLs = new List <ProductSettings.DownloadURL>(); foreach (XmlNode DownloadURLNode in productStaticData.SelectNodes("DownloadURLs/DownloadURL")) { ProductSettings.DownloadURL downloadURL = new ProductSettings.DownloadURL { Arch = XmlParser.GetStringAttribute(DownloadURLNode, "arch").Trim(), URL = XmlParser.GetStringValue(DownloadURLNode).Trim() }; productSettings.DownloadURLs.Add(downloadURL); } bool runWithBitsDefault = XmlParser.GetBoolValue(_xmlDoc.SelectSingleNode("//Config"), ConfigConsts.RUN_WITH_BITS, true); productSettings.ProductEvents = new List <ProductSettings.ProductEvent>(); foreach (XmlNode productLogicNode in productStaticData.SelectNodes("Logic")) { productSettings.Behavior = XmlParser.GetStringValue(productLogicNode, "Behavior"); productSettings.RunWithBits = XmlParser.GetBoolValue(productLogicNode, "RunWithBits", runWithBitsDefault); productSettings.RunAndWait = XmlParser.GetBoolValue(productLogicNode, "RunAndWait"); productSettings.DownloadMethod = XmlParser.GetStringValue(productLogicNode, "DownloadMethod"); if (string.IsNullOrEmpty(productSettings.DownloadMethod)) { productSettings.DownloadMethod = GetConfigValue(ConfigConsts.DOWNLOAD_METHOD); } productSettings.SecondaryDownloadMethod = XmlParser.GetStringValue(productLogicNode, "SecondaryDownloadMethod"); if (string.IsNullOrEmpty(productSettings.SecondaryDownloadMethod)) { productSettings.SecondaryDownloadMethod = GetConfigValue(ConfigConsts.SECONDARY_DOWNLOAD_METHOD); } productSettings.MsiTimeoutMS = XmlParser.GetIntValue(productLogicNode, "MsiTimeoutMs"); foreach (XmlNode eventNode in productLogicNode.SelectNodes("Events/Event")) { if (eventNode.Attributes.Count > 0) { ProductSettings.ProductEvent productEvent = new ProductSettings.ProductEvent { Name = eventNode.Attributes.Item(0).Name, Trigger = XmlParser.GetStringAttribute(eventNode, eventNode.Attributes.Item(0).Name) }; productSettings.ProductEvents.Add(productEvent); } } } productSettings.RunParams = ""; foreach (XmlNode runParamsNode in productStaticData.SelectNodes("RunParams/RunParam")) { string RunParam = XmlParser.GetStringValue(runParamsNode).Trim(); productSettings.RunParams += string.IsNullOrEmpty(productSettings.RunParams) ? RunParam : " " + RunParam; } productSettings.PreInstall = ExtractProductRequirementsRoot(productStaticData.SelectNodes("PreInstall/Requirements")); productSettings.PostInstall = ExtractProductRequirementsRoot(productStaticData.SelectNodes("PostInstall/Requirements")); productSettings.LayoutName = XmlParser.GetStringValue(productStaticData, "Layout"); ControlsLayout defLocaleControlsLayout = null; productSettings.ControlsLayouts = null; XmlNodeList Locales = productSettingsNode.SelectNodes("Locales/Locale"); if (Locales.Count > 0) { foreach (XmlNode localeNode in Locales) { if (XmlParser.GetBoolAttribute(localeNode, "default")) { defLocaleControlsLayout = new ControlsLayout(new XmlNodeList[] { localeNode.SelectNodes("Texts/Text"), localeNode.SelectNodes("Images/Image"), localeNode.SelectNodes("UILayouts") }, _formDesign.DefaultControlDesign); } string localeLanguage = XmlParser.GetStringAttribute(localeNode, "name"); if (localeLanguage == LocaleCode) { productSettings.ControlsLayouts = new ControlsLayout(new XmlNodeList[] { localeNode.SelectNodes("Texts/Text"), localeNode.SelectNodes("Images/Image"), localeNode.SelectNodes("UILayouts") }, _formDesign.DefaultControlDesign); } } if (productSettings.ControlsLayouts == null) { productSettings.ControlsLayouts = defLocaleControlsLayout; } #if DEBUG if (productSettings.ControlsLayouts == null) { Logger.GetLogger().Error("Missing locale for product: " + productSettings.Name + " language code: " + LocaleCode); } #endif } AddAdditionalSettings(ref productSettings, productStaticData, productDynamicData); return(productSettings); }
public static void SaveAsXML(Canvas canvas) { if (canvas.Children == null || canvas.Children.Count == 0) { return; } ControlsLayout layout = new ControlsLayout(); SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.FilterIndex = 1; //Extend the image type saveFileDialog.Filter = "XML File(.xml)|*.xml|All Files (*.*)|*.*"; bool?result = saveFileDialog.ShowDialog(); if (result == true) { var path = saveFileDialog.FileName; int idxline, idxdiagram; idxline = idxdiagram = 0; Dictionary <int, ConnectionDiagramBase> tempdiagrams = new Dictionary <int, ConnectionDiagramBase>(); //create the layout object foreach (var child in canvas.Children) { if (child is ConnectionDiagramBase) { var diagl = ControlsLayout.CreateDiagramLayout(child as ConnectionDiagramBase, idxline++); tempdiagrams.Add(idxline, child as ConnectionDiagramBase); layout.Diagrams.Add(diagl); } } foreach (var child in canvas.Children) { if (child is ConnectionLineBase) { var linec = child as ConnectionLineBase; var linel = ControlsLayout.CreateLineLayout(linec, idxdiagram++); if (linec.OriginDiagram != null) { linel.OriginDiagramID = tempdiagrams.FirstOrDefault(item => item.Value.Equals(linec.OriginDiagram)).Key; } if (linec.TerminalDiagram != null) { linel.TerminalDiagramID = tempdiagrams.FirstOrDefault(item => item.Value.Equals(linec.TerminalDiagram)).Key; } layout.Lines.Add(linel); } } XmlSerializer serializer = new XmlSerializer(typeof(ControlsLayout)); //ファイルを作る FileStream fs = new FileStream(path, FileMode.Create); //書き込み serializer.Serialize(fs, layout); //sclsはSampleClassのインスタンス名 //ファイルを閉じる fs.Close(); } }