I am using the Zxing.Net.Mobile package within my Windows 10 universal app. I use the Default overlay, which is quite nice in my eyes. Now I want to add Flash/Torch funtionality to my application. I only found Solutions defining a new customn overlay. Is it not possible to activate a Torch button in the default overlay? I found a scanner.FlashButtonText Definition, so i think a flashbutton should somehow be activatable and i just dont know the Name of this Parameter. Can someone help me with this? Thanks.
my Code Looks like this:
var options = new MobileBarcodeScanningOptions
{
AutoRotate = false,
TryHarder = true,
PossibleFormats = new List<ZXing.BarcodeFormat>
{
ZXing.BarcodeFormat.EAN_8, ZXing.BarcodeFormat.EAN_13, ZXing.BarcodeFormat.UPC_A, ZXing.BarcodeFormat.UPC_E
}
};
var scanner = new MobileBarcodeScanner(this.Dispatcher);
scanner.UseCustomOverlay = false;
scanner.RootFrame = MyFrame;
scanner.TopText = "Halte die Kamera vor den Barcode";
scanner.BottomText = "Die Kamera scannt den Barcode automatisch";
scanner.FlashButtonText = "activate Torch";
var result = await scanner.Scan(options);
Although MobileBarcodeScanner has a FlashButtonText property, but according to ZXing.Net.Mobile's source code, Flash/Torch function is not supported in the default overlay by now.
The default overlay is set by ZXingScannerControl and if we look at its source code, we will find it does have a button named "buttonToggleFlash". However this button is invisible and there is no property can control its visibility.
source code:
<Border Grid.Row="0" Visibility="Collapsed" VerticalAlignment="Top" HorizontalAlignment="Right" Width="120" Height="80">
<Button x:Name="buttonToggleFlash" Click="buttonToggleFlash_Click">Flash</Button>
</Border>
So to support Flash/Torch function, you need a customn overlay. Or you can edit the source code and rebuild ZXing.Net.Mobile for your purpose.
Related
I create an Entry on Xamarin.Forms using the following code
Entry txtMeasures = new Entry { WidthRequest = 100, Text = "32", TextColor = Color.Black };
The text that should appear is "32" but the entry appears empty on UWP app until I click the entry,
this happen only on Windows, on Mac, Android, iOs, the entry shows the text normally since it appears.
Entry Before Clicking
Entry After Clicking
I add Entry by code behind, but I don't have any issue in Android and UWP.
Firstly, set current cpntentpage stacklayout name as stacklayout1.
<StackLayout x:Name="stacklayout1">
<!-- Place new controls here -->
<Label Text="Welcome to Xamarin.Forms!"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
</StackLayout>
Then add Entry in Stacklayout.
Entry txtMeasures = new Entry { WidthRequest = 100, Text = "32", TextColor = Color.Black };
stacklayout1.Children.Add(txtMeasures);
Seems to be a known issue with Entries on UWP:
Text is not visible on Entry element after animation finished #8503
Entry text initially invisible on UWP #8787
Fix 8503, 8787 - text in Entry not immediately visible, or visible after IsVisible set to true #8536
There are a couple of work arounds (set request height on the entry or where its wrapped in a scrollview have that wrap a ContentPresenter). I'm having this issue related to a scrollView but can't get either workaround to work 🤷♂️
I'm trying to use Xamarin Forms plugin SVG.Forms.Plugin.Abstractions to render scalable SVG files rather than create a file for each device size.
On reading the how-to, it states that to create the image in code I should do this:
new SvgImage
{
SvgPath = "pic.svg",
SvgAssembly = typeof (App).GetTypeInfo().Assembly,
HeightRequest = 200,
WidthRequest = 200,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.End,
BackgroundColor = Color.White
};
However I would rather do this in XAML, and so far have the following
<abstractions:SvgImage Grid.Row="1" Grid.Column="0" SvgAssembly="{Binding SvgAssembly}" SvgPath="{Binding SvgPath}" HeightRequest="250" WidthRequest="250" BackgroundColor="White" HorizontalOptions="Center" VerticalOptions="End"/>
I assume I need to bind SvgPath to a string value in the code behind, but I'm not sure what to bind the SvgAssembly to, I tried a string but it gave an unhandled runtime error.
Does anyone know how to do this?
thanks in advance
You should bind it to an actual assembly.
To simplify, you could just get the assembly from a type that is within the assembly you are looking:
Assembly SvgAssembly = typeof(ClassInAssembly).Assembly;
You should be good to go with this.
If you need to dig a bit deeper, check out my blog post about drawing SVG with SkiaSharp.
I added a redirection link to the reference numbers in a grid that link back to receipts. I followed the instructions given in T200 to perform the task, except
I made the page that opens a popup instead of a new tab. It works for the first reference number I click, but after that it doesn't change the record. Instead the popup displays the record for the first reference number I clicked. Here is my code:
protected void RefNbrReceipt()
{
INRegister row = Receipts.Current;
INReceiptEntry graph = PXGraph.CreateInstance<INReceiptEntry>();
graph.receipt.Current = graph.receipt.Search<INRegister.refNbr>(row.RefNbr);
if (graph.receipt.Current != null)
{
throw new PXPopupRedirectException(graph, "Receipt Details");
}
}
I checked and made sure that the row updates to the selected value (I do have SyncPosition = true on the grid) as well as after the Search that graph.receipt.Current.RefNbr = row.RefNbr. All of the objects in the code when debugging and stepping through it are set to the correct values they should be. Even though these values are showing correctly, when the popup appears, it still has the incorrect record (the first record fetched).
Are you sure Current is set correctly?
If not make sure you use DependOnGrid:
<px:PXDSCallbackCommand Name="RefNbrReceipt" Visible="False" DependOnGrid="grid" CommitChanges="True" /></CallbackCommands>
You can also try setting CurrentDocument and Current cache record before opening the graph:
INRegister inRegister = graph.receipt.Search<INRegister.refNbr>(row.RefNbr);
graph.receipt.CurrentDocument.Current = inRegister;
graph.Caches[typeof(INRegister)].Current = inRegister;
In some scenario with popup windows, you need to issue a refresh command with AutoCallBack-Command and AutoCallBack-Target attributes, you can do that with grid and form containers:
<px:PXSmartPanel ID="pnlActivityLog" runat="server" Width="800px" Height="400px" Style="z-index: 108;" Caption="Activity log" CaptionVisible="True"
Key="ActivityLogs" CommandSourceID="ds" CreateOnDemand="False" AutoCallBack-Command="Refresh" AutoCallBack-Target="gridActivityLog">
<px:PXGrid ID="gridActivityLog" runat="server" Height="200px" Width="100%" BatchUpdate="True" SkinID="Inquire" DataSourceID="ds">
</px:PXPanel>
</px:PXSmartPanel>
I had the same issue PXPopupRedirectException
To solve this I used PXRedirectRequiredException like this:
throw new PXRedirectRequiredException(graph, "Subcontract", true) { Mode = PXBaseRedirectException.WindowMode.NewWindow };
This opens up a new browser window and repaints the controls of the calling window.
This is necessary if you have child grids that are depending on the row you click - and if the use 'changes rows' by clicking directly on the link.
I wonder, if someone has THE CLUE for me on one of my devel problem (sure you do ;-) ).
I try to use a "Dojo Tab Container" with dynamic Dojo Tab Panes.
<xp:div id="tabs">
<xe:djTabContainer id="djTabContainer1" tabPosition="top"
style="height:250px;width:500px" defaultTabContent="defTab">
<xp:this.facets>
<xe:djTabPane xp:key="defTab" id="myTab" partialEvents="true" closable="true">
<xp:panel>
<xp:label value="#{javascript:getComponent('myTab').getTitle()}"></xp:label>
</xp:panel>
</xe:djTabPane>
</xp:this.facets>
</xe:djTabContainer>
</xp:div>
Then there's a SSJS (button) event to add tabs (actually the action is more complex to calculate title etc., but this should explain):
var cont:com.ibm.xsp.extlib.component.dojo.layout.UIDojoTabContainer = getComponent('djTabContainer1');
cont.createTab({id:'tab1', tabUniqueKey:'tab1', tabTitle:'tab1'});
cont.createTab({id:'tab2', tabUniqueKey:'tab2', tabTitle:'tab2'});
cont.createTab({id:'tab3', tabUniqueKey:'tab3', tabTitle:'tab3'});
Now I want to programmatically switch (open) to another tab, or close a tab. It's quite difficult to find useful examples here.
I found out, that I can programmatically switch to another tab via cont.setSelectedTab('2') instead of cont.setSelectedTab('tab2') - as I would expect. For some reason the tabUniqueKey parameter is fully ignored, while the tabTitle parameter isn't. Even worse: it looks like all createTab()-parameters are ignored, except of tabTitle.
Is there an elegant way to get the tab pane component? getComponent('tab2') doesn't work. Neither "id:'tab2'" nor "tabUniqueKey:'tab2'" are taken in account. I can get a tab using getComponent('myTab'), but that's fully useless, if all tabs have the same id.
So, neither does
var cont:com.ibm.xsp.extlib.component.dojo.layout.UIDojoTabContainer = getComponent('djTabContainer1');
var tabSel:com.ibm.xsp.extlib.component.dojo.layout.UIDojoTabPane = comp.selectTab('tab2');
nor
var tabSel:com.ibm.xsp.extlib.component.dojo.layout.UIDojoTabPane = comp.setSelectedTab('tab2');
At least what I'm looking for is something similar to:
cont.closeTab('tab3'); // to close tab3
createTab() returns a UIDojoTabPane pane object and you can use it to select the created tab afterwards:
var cont:com.ibm.xsp.extlib.component.dojo.layout.UIDojoTabContainer = getComponent('djTabContainer1');
var paneTab1:com.ibm.xsp.extlib.component.dojo.layout.UIDojoTabPane = cont.createTab({id:'tab1', tabUniqueKey:'tab1', tabTitle:'tab1'});
...
cont.setSelectedTab(paneTab1.getTabUniqueKey());
You can use this pane object to close the tab too:
paneTab1.closeTab()
Hi
I am new to AS3.0, and what I am trying is to style Label, TextInput from the properties section show to the right.
But I couldnt find any alignment, font-size etc options.
How to style these components at design time, instead of AS3.0 code.
In AS3.0 you can apply these styles to your components with some lines of code. This is an example from Adobe Help
var tf:TextFormat = new TextFormat();
tf.color = 0x333333;
tf.font = "Georgia";
tf.size = 24;
tf.align = "center";
tf.italic = true;
textInput.setStyle("textFormat", tf);
More info here: http://goo.gl/dNCxe