I'm configuring Active Directory Login for Sitecore 9.0.0. And I have issues with IsAdministrator role. I used the following map, but it didn't work.
Any idea about how to configure it?
<map name="Administrator Claim" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication">
<data hint="raw:AddData">
<source name="Administrator" />
<target name="IsAdministrator" value="true" />
</data>
</map>
You have to map http://www.sitecore.net/identity/claims/isAdmin claim in Sitecore.Owin.Authentication.IdentityServer.config file in the propertyInitializer section as follows:
<propertyInitializer>
<maps>
<map name="set IsAdministrator" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication">
<data hint="raw:AddData">
<source name="http://www.sitecore.net/identity/claims/isAdmin" value="true" />
<target name="IsAdministrator" value="true" />
</data>
</map>
</maps>
</propertyInitializer>
Read more details here.
I am trying to trigger the cordova camera plugin from inside reactjs. In previous iterations It was utilizing a simple HTML5 file input.
Upon further research I discovered that that the current webview that cordova uses for android platforms does not provide an option for camera control (thus the native cordova plugin).
I am trying to trigger the cordova camera plugin from inside reactjs after being built with:
npm run build
then the contents of the app's build directory are coppied to cordovas 'www' directory.
The Cordova app is relatively vanilla and camera plugin added with the command.
cordova plugin add cordova-plugin-camera
Here is the config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-console" spec="^1.1.0" />
<plugin name="cordova-plugin-camera" spec="^4.0.3" />
<plugin name="cordova-plugin-media-capture" spec="^3.0.2" />
<engine name="android" spec="^7.1.4" />
</widget>
The React Component is as follows
import React, { Component } from "react";
import { Alert } from "reactstrap";
import "../../Containers/containers.css";
import { connect } from "react-redux";
import userTools from "../../Services/userTools";
class Avatar extends Component {
constructor() {
super();
this.state = {
avatar: "https://denisol.se/wp-content/uploads/2018/05/empty-avatar.jpg"
};
}
takepicture() {
if (!window.cordova) {
var Camera;
//Unless theres another way to suppress webpack
//During Build
}
navigator.camera.getPicture(
file => this.readFiles(file),
err => console.log(err),
{
quality: 50,
destinationType: Camera.DestinationType.FILE_URI
}
);
}
readFiles(file) {
var reader = new FileReader();
reader.readAsDataURL(file);
reader.addEventListener(
"load",
() => {
console.log(reader.result);
this.setState({
avatar: reader.result
});
},
false
);
}
render() {
var avatarurl;
if (this.props.myinfo && this.props.myinfo.avatar.avatar.url) {
avatarurl = this.props.myinfo.avatar.url;
} else {
avatarurl =
"https://denisol.se/wp-content/uploads/2018/05/empty-avatar.jpg";
}
if (this.props.new) {
avatarurl = this.state.avatar;
}
return (
<div>
<img
id="avatar"
alt="test"
src={avatarurl}
onClick={() => {
if (this.props.updatable || this.props.new) {
this.takepicture();
//As for normal html input you would do the following
this.refs.fileUploader.click();
}
}}
/>
<input
type="file"
name="avatar"
ref="fileUploader"
style={{ display: "none" }}
accept="image/*;capture=camera"
capture
onChange={e => {
if (e.target.files.length && this.props.updatable) {
userTools.updateAvatar(e.target.files[0]);
} else if (e.target.files.length && this.props.new) {
this.readFiles(e.target.files[0]);
this.props.newAvatar(e.target.files[0]);
}
}}
/>
</div>
);
}
}
function mapStateToProps(state) {
return { myinfo: state.myinfoReducer };
}
export default connect(mapStateToProps)(Avatar);
when i execute the function there seems to be no response from cordova (permissions request, camera opening, ect...). Note that this component is only part of a larger react project where everything else is working more or less as expected.
Any Help is greatly appreciated thanks.
i made this sample repo to study the problem and it seems to be recovering the image correctly.
By doing this and reading the event handling docs, a possible cause could be the lack of bind() on handlers since this is a class component.
Please see the repo and i really rope it helps.
I was able to get the camera functionality working by migrating my react project over to browserify. Not the simplest solution but will work for the time being thanks for that tip.
Both the TextField and the TextArea in the attached image have the same UIID. I have set the left padding be 1 mm using theme designer.
You can see that the left padding is applied to the TextField but not the TextArea.
I have also attempted to set it manually in the code using gui_TextArea.getAllStyles().setPaddingLeft(1); and gui_textArea.getAllStyles().setPadding(1,1,1,1); to no effect.
There does not appear to be a setTextUIID() method for TextArea.
How do we set the padding for this component?
Full source per Steve's request:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.this.that.gui;
import com.codename1.ui.Button;
import com.codename1.ui.Component;
import com.codename1.ui.Container;
import com.codename1.ui.Dialog;
import com.codename1.ui.Display;
import com.codename1.ui.TextField;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.ui.layouts.FlowLayout;
import com.codename1.ui.layouts.LayeredLayout;
import com.codename1.ui.plaf.Style;
import com.this.that.Constants;
import com.this.that.Main;
import com.this.that.util.MyNetwork;
import com.this.that.util.MyToolbar;
import com.this.that.util.MyValidator;
import com.this.that.util.User;
import java.util.HashMap;
import java.util.Map;
/**
* GUI builder created Form
*/
public class Contact extends com.codename1.ui.Form {
private User user;
public Contact() {
this(com.codename1.ui.util.Resources.getGlobalResources());
}
public Contact(com.codename1.ui.util.Resources resourceObjectInstance) {
initGuiBuilderComponents(resourceObjectInstance);
Style s = gui_Message.getAllStyles();
s.setPaddingUnit(Style.UNIT_TYPE_DIPS);
s.setPadding(6, 6, 6, 6);
this.revalidate();
}
//-- DON'T EDIT BELOW THIS LINE!!!
private com.codename1.ui.Container gui_welcomeContainer = new com.codename1.ui.Container(new com.codename1.ui.layouts.BorderLayout());
private com.codename1.ui.Label gui_null = new com.codename1.ui.Label();
private com.codename1.ui.Container gui_BodyContainer = new com.codename1.ui.Container(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS));
private com.codename1.ui.Label gui_spacer1 = new com.codename1.ui.Label();
private com.codename1.ui.TextField gui_Subject = new com.codename1.ui.TextField();
private com.codename1.ui.TextArea gui_Message = new com.codename1.ui.TextArea();
private com.codename1.ui.Button gui_SubmitButton = new com.codename1.ui.Button();
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void guiBuilderBindComponentListeners() {
EventCallbackClass callback = new EventCallbackClass();
gui_SubmitButton.addActionListener(callback);
}
class EventCallbackClass implements com.codename1.ui.events.ActionListener, com.codename1.ui.events.DataChangedListener {
private com.codename1.ui.Component cmp;
public EventCallbackClass(com.codename1.ui.Component cmp) {
this.cmp = cmp;
}
public EventCallbackClass() {
}
public void actionPerformed(com.codename1.ui.events.ActionEvent ev) {
com.codename1.ui.Component sourceComponent = ev.getComponent();
if(sourceComponent.getParent().getLeadParent() != null && (sourceComponent.getParent().getLeadParent() instanceof com.codename1.components.MultiButton || sourceComponent.getParent().getLeadParent() instanceof com.codename1.components.SpanButton)) {
sourceComponent = sourceComponent.getParent().getLeadParent();
}
if(sourceComponent == gui_SubmitButton) {
onSubmitButtonActionEvent(ev);
}
}
public void dataChanged(int type, int index) {
}
}
private void initGuiBuilderComponents(com.codename1.ui.util.Resources resourceObjectInstance) {
guiBuilderBindComponentListeners();
setLayout(new com.codename1.ui.layouts.BoxLayout(com.codename1.ui.layouts.BoxLayout.Y_AXIS));
setInlineStylesTheme(resourceObjectInstance);
setScrollableY(false);
setInlineStylesTheme(resourceObjectInstance);
setTitle("");
setName("Contact");
addComponent(gui_welcomeContainer);
gui_welcomeContainer.setUIID("welcomeContainer");
gui_welcomeContainer.setInlineStylesTheme(resourceObjectInstance);
gui_welcomeContainer.setName("welcomeContainer");
((com.codename1.ui.layouts.BorderLayout)gui_welcomeContainer.getLayout()).setCenterBehavior(com.codename1.ui.layouts.BorderLayout.CENTER_BEHAVIOR_CENTER);
gui_welcomeContainer.addComponent(com.codename1.ui.layouts.BorderLayout.CENTER, gui_null);
gui_null.setText("Contact Us");
gui_null.setUIID("welcomeLabel");
gui_null.setInlineStylesTheme(resourceObjectInstance);
addComponent(gui_BodyContainer);
gui_BodyContainer.setInlineStylesTheme(resourceObjectInstance);
gui_BodyContainer.setName("BodyContainer");
gui_BodyContainer.addComponent(gui_spacer1);
gui_BodyContainer.addComponent(gui_Subject);
gui_BodyContainer.addComponent(gui_Message);
gui_BodyContainer.addComponent(gui_SubmitButton);
gui_spacer1.setText(" ");
gui_spacer1.setInlineStylesTheme(resourceObjectInstance);
gui_spacer1.setName("spacer1");
gui_Subject.setScrollVisible(true);
gui_Subject.setHint(" Subject");
gui_Subject.setUIID("TextField");
gui_Subject.setInlineStylesTheme(resourceObjectInstance);
gui_Subject.setName("Subject");
gui_Subject.setColumns(20);
gui_Message.setHint(" Please enter a brief message");
gui_Message.setUIID("TextField");
gui_Message.setInlineStylesTheme(resourceObjectInstance);
gui_Message.setName("Message");
gui_Message.setMaxSize(1000);
gui_Message.setColumns(20);
gui_Message.setRows(10);
gui_SubmitButton.setText("Submit");
gui_SubmitButton.setInlineStylesTheme(resourceObjectInstance);
gui_SubmitButton.setName("SubmitButton");
gui_SubmitButton.setTextPosition(com.codename1.ui.Component.BOTTOM);
gui_welcomeContainer.setUIID("welcomeContainer");
gui_welcomeContainer.setInlineStylesTheme(resourceObjectInstance);
gui_welcomeContainer.setName("welcomeContainer");
((com.codename1.ui.layouts.BorderLayout)gui_welcomeContainer.getLayout()).setCenterBehavior(com.codename1.ui.layouts.BorderLayout.CENTER_BEHAVIOR_CENTER);
gui_BodyContainer.setInlineStylesTheme(resourceObjectInstance);
gui_BodyContainer.setName("BodyContainer");
}// </editor-fold>
//-- DON'T EDIT ABOVE THIS LINE!!!
public void onSubmitButtonActionEvent(com.codename1.ui.events.ActionEvent ev) {
if (gui_Subject.getText().equals("") || gui_Message.getText().equals("")) {
Main.showDialog("You must enter all fields.");
} else {
if (user.getName() == null || user.getEmail() == null) {
requestNameOrEmail();
}
else{
sendMessage(false);
}
}
}
private void requestNameOrEmail(){
Dialog d = new Dialog(new BoxLayout(BoxLayout.Y_AXIS));
d.setTitle("Require Name/Email to Send");
Container nameLayeredLayout = new Container(new LayeredLayout());
TextField name = new TextField();
name.setHint("Name");
nameLayeredLayout.add(name);
Container emailLayeredLayout = new Container(new LayeredLayout());
TextField email = new TextField();
email.setHint("Email");
emailLayeredLayout.add(email);
if(user.getName() != null){
name.setText(user.getName());
}
if(user.getEmail() != null){
email.setText(user.getEmail());
}
Map<String, Boolean> validatorParams = new HashMap<>();
validatorParams.put("name", false);
validatorParams.put("email", false);
MyValidator v = new MyValidator(validatorParams);
v.setupLengthConstraint(nameLayeredLayout, name, 2, 30, "name", "Name must be 2-30 characters.");
v.setupEmailConstraint(emailLayeredLayout, email, "email", "Email not valid.");
Container buttonCnt = new Container();
Button cancel = new Button("Cancel");
cancel.addActionListener((l) -> {
d.dispose();
});
Button submit = new Button("Submit");
submit.addActionListener((l) -> {
if (v.isValid()) {
d.dispose();
sendMessage(true);
}
});
buttonCnt.add(cancel).add(submit);
d.add(nameLayeredLayout).add(emailLayeredLayout).add(FlowLayout.encloseCenter(buttonCnt));
d.show();
}
private void sendMessage(boolean updateUser) {
Map<String, String> params = new HashMap<>();
params.put("update_user",String.valueOf(updateUser));
params.put("sender_name", user.getName());
params.put("sender_email", user.getEmail());
params.put("sender_udid", Display.getInstance().getUdid());
params.put("subject", gui_Subject.getText());
params.put("message", gui_Message.getText());
MyNetwork.getInstance().getNetworkObject("POST", Constants.SEND_EMAIL, params, "noDialog");
Main.showDialog("Message sent.");
Home form = new Home();
MyToolbar.getInstance().setupToolbar(form);
form.show();
}
}
Here is the .gui for the form
<?xml version="1.0" encoding="UTF-8"?>
<component type="Form" layout="BoxLayout" boxLayoutAxis="Y" scrollableY="false" title="" name="Contact">
<component type="Container" layout="BorderLayout" borderLayoutAbsoluteCenter="true" uiid="welcomeContainer" name="welcomeContainer">
<component type="Label" uiid="welcomeLabel" text="Contact Us">
<layoutConstraint value="Center" />
</component>
</component>
<component type="Container" layout="BoxLayout" boxLayoutAxis="Y" name="BodyContainer">
<component type="Label" text=" " name="spacer1">
</component>
<component type="TextField" uiid="TextField" hint=" Subject" scrollVisible="true" columns="20" constraint="0" name="Subject">
</component>
<component type="TextArea" uiid="TextField" hint=" Please enter a brief message" rows="10" columns="20" maxSize="1000" constraint="0" name="Message">
</component>
<component type="Button" text="Submit" textPosition="2" name="SubmitButton" actionEvent="true">
</component>
</component>
</component>
Here are the relevant lines from theme.xml (uiid is set to TextField)
<gradient key="TextArea.bgGradient" color1="0" color2="0" posX="0.5" posY="0.5" radius="1.0" />
<val key="TextArea.bgType" value="0" />
<border key="TextArea.border" type="image" i1="TextField.borderTop_1.png" i2="TextField.borderBottom_1.png" i3="TextField.borderLeft_1.png" i4="TextField.borderRight_1.png" i5="TextField.borderTopL_1.png" i6="TextField.borderTopR_1.png" i7="TextField.borderBottomL_1.png" i8="TextField.borderBottomR_1.png" i9="TextField.borderCenter_1.png" />
<val key="TextArea.fgColor" value="0" />
<font key="TextArea.font" type="ttf" face="0" style="0" size="0" name="native:MainRegular" family="native:MainRegular" sizeSettings="3" actualSize="3.0" />
<val key="TextArea.marUnit" value="2,2,2,2" />
<val key="TextArea.margin" value="1.0,1.0,1.0,1.0" />
<val key="TextArea.padUnit" value="2,2,2,2" />
<val key="TextArea.padding" value="0.0,0.0,2.0,1.0" />
<gradient key="TextArea.press#bgGradient" color1="0" color2="0" posX="0.5" posY="0.5" radius="1.0" />
<val key="TextArea.press#bgType" value="0" />
<border key="TextArea.press#border" type="image" i1="TextField.borderTop_1.png" i2="TextField.borderBottom_1.png" i3="TextField.borderLeft_1.png" i4="TextField.borderRight_1.png" i5="TextField.borderTopL_1.png" i6="TextField.borderTopR_1.png" i7="TextField.borderBottomL_1.png" i8="TextField.borderBottomR_1.png" i9="TextField.borderCenter_1.png" />
<val key="TextArea.press#fgColor" value="0" />
<font key="TextArea.press#font" type="ttf" face="0" style="0" size="0" name="native:MainRegular" family="native:MainRegular" sizeSettings="3" actualSize="3.0" />
<val key="TextArea.press#marUnit" value="2,2,2,2" />
<val key="TextArea.press#margin" value="1.0,1.0,1.0,1.0" />
<val key="TextArea.press#padUnit" value="2,2,2,2" />
<val key="TextArea.press#padding" value="0.0,0.0,2.0,1.0" />
<val key="TextArea.press#transparency" value="0" />
<gradient key="TextArea.sel#bgGradient" color1="0" color2="0" posX="0.5" posY="0.5" radius="1.0" />
<val key="TextArea.sel#bgType" value="0" />
<border key="TextArea.sel#border" type="image" i1="TextField.borderTop_1.png" i2="TextField.borderBottom_1.png" i3="TextField.borderLeft_1.png" i4="TextField.borderRight_1.png" i5="TextField.borderTopL_1.png" i6="TextField.borderTopR_1.png" i7="TextField.borderBottomL_1.png" i8="TextField.borderBottomR_1.png" i9="TextField.borderCenter_1.png" />
<val key="TextArea.sel#fgColor" value="0" />
<font key="TextArea.sel#font" type="ttf" face="0" style="0" size="0" name="native:MainRegular" family="native:MainRegular" sizeSettings="3" actualSize="3.0" />
<val key="TextArea.sel#marUnit" value="2,2,2,2" />
<val key="TextArea.sel#margin" value="1.0,1.0,1.0,1.0" />
<val key="TextArea.sel#padUnit" value="2,2,2,2" />
<val key="TextArea.sel#padding" value="0.0,0.0,2.0,1.0" />
<val key="TextArea.sel#transparency" value="0" />
<val key="TextArea.transparency" value="0" />
<gradient key="TextField.bgGradient" color1="0" color2="0" posX="0.5" posY="0.5" radius="1.0" />
<val key="TextField.bgType" value="0" />
<border key="TextField.border" type="image" i1="TextField.borderTop_1.png" i2="TextField.borderBottom_1.png" i3="TextField.borderLeft_1.png" i4="TextField.borderRight_1.png" i5="TextField.borderTopL_1.png" i6="TextField.borderTopR_1.png" i7="TextField.borderBottomL_1.png" i8="TextField.borderBottomR_1.png" i9="TextField.borderCenter_1.png" />
<val key="TextField.fgColor" value="0" />
<font key="TextField.font" type="ttf" face="0" style="0" size="0" name="native:MainRegular" family="native:MainRegular" sizeSettings="3" actualSize="3.0" />
<val key="TextField.marUnit" value="2,2,2,2" />
<val key="TextField.margin" value="1.0,1.0,1.0,1.0" />
<val key="TextField.padUnit" value="0,2,0,2" />
<val key="TextField.padding" value="0.0,0.0,2.0,1.0" />
<gradient key="TextField.press#bgGradient" color1="0" color2="0" posX="0.5" posY="0.5" radius="1.0" />
<val key="TextField.press#bgType" value="0" />
<border key="TextField.press#border" type="image" i1="TextField.borderTop_1.png" i2="TextField.borderBottom_1.png" i3="TextField.borderLeft_1.png" i4="TextField.borderRight_1.png" i5="TextField.borderTopL_1.png" i6="TextField.borderTopR_1.png" i7="TextField.borderBottomL_1.png" i8="TextField.borderBottomR_1.png" i9="TextField.borderCenter_1.png" />
<val key="TextField.press#fgColor" value="0" />
<font key="TextField.press#font" type="ttf" face="0" style="0" size="0" name="native:MainRegular" family="native:MainRegular" sizeSettings="3" actualSize="3.0" />
<val key="TextField.press#marUnit" value="2,2,2,2" />
<val key="TextField.press#margin" value="1.0,1.0,1.0,1.0" />
<val key="TextField.press#padUnit" value="0,2,0,2" />
<val key="TextField.press#padding" value="0.0,0.0,1.0,1.0" />
<val key="TextField.press#transparency" value="0" />
<gradient key="TextField.sel#bgGradient" color1="0" color2="0" posX="0.5" posY="0.5" radius="1.0" />
<val key="TextField.sel#bgType" value="0" />
<border key="TextField.sel#border" type="image" i1="TextField.borderTop_1.png" i2="TextField.borderBottom_1.png" i3="TextField.borderLeft_1.png" i4="TextField.borderRight_1.png" i5="TextField.borderTopL_1.png" i6="TextField.borderTopR_1.png" i7="TextField.borderBottomL_1.png" i8="TextField.borderBottomR_1.png" i9="TextField.borderCenter_1.png" />
<val key="TextField.sel#fgColor" value="0" />
<font key="TextField.sel#font" type="ttf" face="0" style="0" size="0" name="native:MainRegular" family="native:MainRegular" sizeSettings="3" actualSize="3.0" />
<val key="TextField.sel#marUnit" value="2,2,2,2" />
<val key="TextField.sel#margin" value="1.0,1.0,1.0,1.0" />
<val key="TextField.sel#padUnit" value="0,2,0,2" />
<val key="TextField.sel#padding" value="0.0,0.0,1.0,1.0" />
<val key="TextField.sel#transparency" value="0" />
<val key="TextField.transparency" value="0" />
Here is a screenshot of the Theme Designer showing padding for Selected TextField UIID. Padding in millimeters is also applied to unselected and pressed. Both components share this UIID but the padding is only appearing on the text field component, not the text area component. This behavior does not change if the lines that I added in the code to set padding are present or not.
You see in the screenshot that left and right are both in mm while top/bottom are in pixels. I also set it so that all four units are mm and it did not change the behavior.
(We are using CN1 v4.0)
To resolve the issue, I ended up doing the following:
Reverted my project to a prior commit that did not have any padding styling for TextArea or TextField
In the Theme Designer I edited the padding on each state one-by-one instead of copying the styling from one state to another.
I am suspecting but cannot say for certain that the issue was caused by the act of copy/pasting the styling in the Theme Designer. AFAIK that is the only difference between the working and non-working versions of the styling. I seem to recall running into issues when doing copy/paste in the designer in the past.
setPaddingLeft(1); would override setPadding(1,1,1,1); and visa versa. You need to make sure that you do these things before the form is shown and if you do them after you need to revalidate as this will impact layout.
However, in your case I'm guessing you need to invoke setPaddingUnit(Style.UNIT_TYPE_DIPS); to make sure that padding is in a visible unit. Make sure to invoke that before the setPadding call.
Form hi = new Form("Padding", BoxLayout.y());
TextArea unpadded = new TextArea("Unpadded");
TextArea padded = new TextArea("Padded");
Style s = padded.getAllStyles();
s.setPaddingUnit(Style.UNIT_TYPE_DIPS);
s.setPadding(6, 6, 6, 6);
hi.addAll(unpadded, padded);
hi.show();
This question already has an answer here:
WPF-Log4Net used inside VSIX extension did not output log when installed at target VS
(1 answer)
Closed 4 years ago.
I have a WPF solution. I downloaded log4net dll, I added log4net.config and had set the "Copy to Output Directory" value as "Copy always".
log4net.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="myapp.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger - %message%newline" />
</layout>
</appender>
</log4net>
</configuration>
And I added the below line in AssemblyInfo.cs:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
then the below code in my TestWindowControl.xaml.cs
public partial class TestWindowControl : UserControl
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public TestWindowControl()
{
XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));
log.Info("info testing");
log.Debug("debug testing");
log.Error("error testing");
log.Fatal("fatal testing");
log.Warn("warn testing");
}
}
But logs are not writing to the file. It's working in Console application but not working for WPF. Am I missing something?
Try to set the filter inside appender
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="WARN" />
<levelMax value="ERROR" />
</filter>
I added the splashscreen plugin using this:
cordova plugin add cordova-plugin-splashscreen
I have images for the icon and splashscreen and added them to the resources folder and have added this code in my controller.js:
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
setTimeout(function() {
navigator.splashscreen.hide();
}, 300);
});
})
And I added the following in my config.xml:
<preference name="ShowSplashScreen" value="true" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="FadeSplashScreen" value="false" />
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>
And also this:
<platform name="android">
<icon src="resources/android/icon/icon.png" />
<splash src="resources/android/splash/screen.png" />
</platform>
But after building my app (using adobe's online phonegap builder) the icon shows, but the app starts with a blank white screen for a few seconds instead of the splashscreen. What could be the problem?
Add the plugin with :
$ ionic plugin add org.apache.cordova.splashscreen
$ ionic platform add android
$ ionic build android
$ ionic run android
Once the image is created, you have to include it in your project by adding the following to config.xml:
<splash src="pathtosplashimage" />
Example Configuration
In the top-level config.xml file (not the one in platforms), add configuration elements like those specified here.
Please notice that the value of the "src" attribute is relative to the project root directory and not to the www directory (see Directory structure below). You can name the source image whatever you like. The internal name in the app is determined by Cordova.
Directory structure:
projectRoot
hooks
platforms
plugins
www
css
img
js
res
screen
android
ios
windows
<platform name="android">
<!-- you can use any density that exists in the Android project -->
<splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/>
<splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/>
<splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/>
<splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/>
<splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/>
<splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/>
<splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/>
<splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/>
</platform>
<platform name="ios">
<!-- There are two mechanisms for showing launch images.
-- Legacy method (supports all devices except iPad Pro 12.9):
-- Note: Images are determined by width and height. The following are supported -->
<splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/>
<splash src="res/screen/ios/Default#2x~iphone.png" width="640" height="960"/>
<splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
<splash src="res/screen/ios/Default-Portrait#2x~ipad.png" width="1536" height="2048"/>
<splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
<splash src="res/screen/ios/Default-Landscape#2x~ipad.png" width="2048" height="1536"/>
<splash src="res/screen/ios/Default-568h#2x~iphone.png" width="640" height="1136"/>
<splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/>
<splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/>
<splash src="res/screen/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
<!-- Storyboard method (supports all devices):
-- Important: If you use the storyboard method, legacy images are
-- copied but ignored.
-- Note: images are determined by scale, idiom, and size traits. The following
-- are suggested based on current device form factors -->
<splash src="res/screen/ios/Default#2x~universal~anyany.png" />
<splash src="res/screen/ios/Default#2x~universal~comany.png" />
<splash src="res/screen/ios/Default#2x~universal~comcom.png" />
<splash src="res/screen/ios/Default#3x~universal~anyany.png" />
<splash src="res/screen/ios/Default#3x~universal~anycom.png" />
<splash src="res/screen/ios/Default#3x~universal~comany.png" />
</platform>
<preference name="SplashScreenDelay" value="10000" />
More information can be found on https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/