Flyout Settings Design Windows 8.1 - caliburn.micro

In the Caliburn.Micro Version 2.0 I can create a new Settings flyout like this:
settingsService.RegisterFlyoutCommand<SettingsViewModel>("Custom");
How can I change or set the Back Color and Header of the setting flyout?

RegisterFlyoutCommand() takes viewSettings for this purpose. You can set the properties available on SettingsFlyout:
var viewSettings = new Dictionary<string, object>();
viewSettings["HeaderBackground"] = new SolidColorBrush(Colors.Yellow);
settingsService.RegisterFlyoutCommand<SettingsViewModel>("Custom", viewSettings);

Related

How do I create something that works like a logging control in Xamarin.Forms

I'm after something like the application output window in Visual Studio, like so:
I'd like to be able to:
bind to an ObservableCollection of strings
select and copy text (as shown in the screenshot above)
At present this is for a Mac app, although iOS may follow later.
I've tried these:
Editor - Problem is it only exposes a Text property that I can bind to and not a collection. Sooner or later, the maximum string length will be reached.
ListView with Label for ViewCell - Problem is text from a Label is not selectable, let alone having multiple lines (bound collection items) selectable.
Using a custom renderer for Mac that makes use of NSTextView and appending to textStorage every time a new item is added, but again, there’s a limit to how much you can add to textStorage.
I'm open to using third-party tools such as Syncfusion, if that makes it easier.
Custom a method to deal with list data to combine them into a newline string :
public string formatstring(NSArray objects)
{
StringBuilder stringBuilder = new StringBuilder();
for(nuint i=0;i< objects.Count; i++)
{
stringBuilder.Append(objects.GetItem<NSString>(i) +"\n");
}
return stringBuilder.ToString();
}
Then used in NSTextView as follow :
string[] items = new string[] {"111111" , "222222" , "333333" , "444444" , "555555" };
NSArray array = NSArray.FromStrings(items);
NSTextView textView = new NSTextView(new CGRect(100,160,200,100));
textView.BackgroundColor = NSColor.Gray;
textView.Value = formatstring(array);
View.AddSubview(textView);
The effect :

Auto Fill Web Forms in .net-Core

I am new to .net core.
How can I auto fill forms and submit in dotnet core ?
Please find following sample URLs I want to try
https://mparivahan.in/uyt/?pur_cd=102
Value - 1 = "MH1R"
Value - 2 = "5656"
https://www.filegstrstnow.com/searchGSTTaxpayer
sample Value = "24AADCS0852Q1Z2"
With Regards
I guess you want to automate operations in browser. For this purpose you need a browser automation framework which can be used in you .NET Core 2.0 code. Something like Selenium WebDriver. In this case you code will look like this:
[Test]
public void TestWithFirefoxDriver()
{
using (var driver = new FirefoxDriver())
{
driver.Navigate().GoToUrl(#"https://parivahan.gov.in/rcdlstatus/?pur_cd=102");
driver.FindElement(By.Id("form_rcdl:tf_reg_no1")).Send("GJ01RR");
driver.FindElement(By.Id("form_rcdl:tf_reg_no2")).Send("5656");
driver.FindElement(By.Id("form_rcdl:j_idt36")).Click();
var wait = new WebDriverWait(driver, TimeSpan.FromMinutes(1));
// Find element with the result to retrieve value, and so on..
}
}
Note: I didn't check the code above in runtime, it is just for demonstration purposes.
To run Selenium automation code without opening the browser you could use PhantomJS driver instead of drivers for real browsers like FirefoxDriver. Change this line:
using (var driver = new FirefoxDriver())
to:
using (var driver = new PhantomJSDriver())

Problem with Flex DataVisualization Charting components Rendering Labels on Build Server

I'm having a problem with labels disappearing on Flex's datavisualization.swc charts that are built on our build server via ANT and the Flex 3.3 SDK. I've made sure that our license is applied properly on the build server (hence no water marks), and I've made sure the exact same datavisualization.swc was copied from my dev machine into the Flex3.3SDK/frameworks/libs directory.
Any ideas? Could it be a font problem? (Though we're really only using default fonts.)
Here's the problem, missing axis labels on the build server
alt text http://img687.imageshack.us/img687/5038/chartwithmissingaxislab.png
Here's how it's supposed to look with labels (taken on my local development machine)
alt text http://img683.imageshack.us/img683/1504/chartwithaxislabels.png
I got it working using the helpful information I found at the Flex Coders archive.
Basically, in an initalize event handler, I added the following code:
var ccClassFactory:ContextualClassFactory = new ContextualClassFactory(ChartAxisTextLabel);
ccClassFactory.moduleFactory=this.moduleFactory;
var hAxisRenderer:AxisRenderer = new AxisRenderer();
hAxisRenderer.axis = hAxis;
hAxisRenderer.labelRenderer=ccClassFactory;
var vAxisRenderer:AxisRenderer = new AxisRenderer();
vAxisRenderer.axis = vertAxis;
vAxisRenderer.labelRenderer=ccClassFactory;
lineChart.horizontalAxis=hAxis;
lineChart.verticalAxis=vertAxis;
lineChart.horizontalAxisRenderers = [ hAxisRenderer ];
lineChart.verticalAxisRenderers = [ vAxisRenderer ];
Also, I had to create the class:
public class ChartAxisTextLabel extends Label
{
public function ChartAxisTextLabel()
{
super();
}
override public function set data(value:Object):void
{
super.data = value;
text = value.text;
}
}

How do I detect whether a window is hidden (cmd-h) vs closed (cmd-w) - Mac

I'm developing an AIR application which uses multiple windows. I'm running into an issue where I want to open new windows (toaster notifications for example) when the primary application window is not visible, but the behavior is different depending on how the window is closed.
When a user hides all application windows with CMD-H, opening a new window causes all application windows to come back to the foreground (instead of just that new window, like I would expect). If the user closed a window with CMD-W, however, that window does not become visible when I open a new window.
Is there a way to either 1) tell when the user uses cmd-h to hide all windows OR 2) tell whether a window is hidden using cmd-h vs. closed cmd-w?
Thanks
I actually just figured out a good answer to this problem. Apparently, the reason cmd-H and cmd-W don't trigger keyDown events are because they are capturee and stopped by the native application menu.
By default, several "normal" mac OS menu options are put into AIR applications by the framework - these include cmd-w to close the window, cmd-h to hide and shortcuts around copy/cut/paste. In order to avoid the default behavior, I either removed these menu options or changed their key equivalents (the shortcut combination that triggers them).
The code to add a preferences shortcut (cmd-,), override cmd-w, change cmd-w to cmd-shift-w, and override the cmd-h functionality looks like this:
if (NativeApplication.supportsMenu) {
var prefItem:NativeMenuItem = new NativeMenuItem("Preferences...");
prefItem.addEventListener(Event.SELECT, handlePreferencesMenuSelect);
prefItem.keyEquivalent = ",";
var closeItem:NativeMenuItem = new NativeMenuItem("Close Tab");
closeItem.addEventListener(Event.SELECT, handleCloseTabMenuSelect);
closeItem.keyEquivalent = "w";
// Add the preferences option under the first menu
// Also add a spacer line (like most other applications)
// Also change the hide command to our own handler
var baseMenu:NativeMenuItem = NativeMenuItem(NativeApplication.nativeApplication.menu.items[0]);
baseMenu.submenu.addItemAt(new NativeMenuItem("", true), 1);
baseMenu.submenu.addItemAt(prefItem, 2);
for (var idx:String in baseMenu.submenu.items) {
var menuItem:NativeMenuItem = baseMenu.submenu.items[idx];
if (menuItem && menuItem.keyEquivalent == 'h' && menuItem.keyEquivalentModifiers.length == 1) {
baseMenu.submenu.removeItemAt(int(idx));
var hideItem:NativeMenuItem = new NativeMenuItem("Hide Application");
hideItem.addEventListener(Event.SELECT, handleHideWindowSelect);
hideItem.keyEquivalent = "h";
baseMenu.submenu.addItemAt(hideItem, int(idx));
}
}
// Set the close window shortcut to cmd+shift+w, instead of cmd+w
var fileMenu:NativeMenuItem = NativeMenuItem(NativeApplication.nativeApplication.menu.items[1]);
NativeMenuItem(fileMenu.submenu.getItemAt(0)).keyEquivalent = 'W';
fileMenu.submenu.addItem(closeItem);
}
Thanks for the help figuring it out.

How to publish an item in Sitecore 5.3 using the API

Using Sitecore 5.3, what API calls would be necessary to publish a given item? If there are multiple publication targets configured, how would you specify which target to publish to?
My code is actually for Sitecore 6 but we used almost the same code when we ran 5.3
Needlessly to say maybe but in the code we publish from Master to Web and we only publish items under the node /sitecore/content/home/projects/ongoing
DateTime publishDate = DateTime.Now;
var master = Sitecore.Configuration.Factory.GetDatabase("master");
var targetDB = Sitecore.Configuration.Factory.GetDatabase("web");
var pubOpts = new Sitecore.Publishing.PublishOptions(master, targetDB, Sitecore.Publishing.PublishMode.Full, Sitecore.Data.Managers.LanguageManager.GetLanguage("sv", master), publishDate);
pubOpts.Deep = true;
string idstr = master.Items["/sitecore/content/Home/Projects/Ongoing"].ID.ToString();
var id = new ID(idstr);
pubOpts.RootItem = master.Items[id];
var pub = new Sitecore.Publishing.Publisher(pubOpts);
Sitecore.Jobs.Job pubJob = pub.PublishAsync();
pubJob.Start();
You can find the code for Sitecore 5.3 on the sdn.

Resources