Well I was wondering why i can't save ringtones on windows phone
SaveRingtone ringtone = new SaveRingtone();
ringtone.Source = new Uri("appdata:/"+path);
ringtone.DisplayName = b.Content.ToString();
ringtone.Completed += Ringtone_Save_completed;
ringtone.Show();
this is my code
Well you was so close.
The class SaveRingtone it is SaveRingtoneTask
SaveRingtoneTask ringtone = new SaveRingtoneTask();
ringtone.Source = new Uri("appdata:/"+path);
ringtone.DisplayName = b.Content.ToString();
ringtone.Completed += Ringtone_Save_completed;
ringtone.Show();
and you will need to add
using Microsoft.Phone.Tasks;
Related
How to use ItemBand in Subreport when coding it with Pentaho Reporting Engine?
I have defined my ItemBand as follow :
ItemBand rowBand = new ItemBand();
TextFieldElementFactory textFactory3 = new TextFieldElementFactory();
textFactory3.setFieldname("reportname");
Element element = textFactory3.createElement();
element.setDynamicContent(true);
rowBand.addElement(element);
itemBand2.addElement(rowBand);
Now how do I use the ItemBand in my subreport?
Tests for the project are usually helpfull in such cases https://github.com/pentaho/pentaho-reporting/blob/85b5bb6c1b970f1c2648a6bf06b7cf66b9fd0c0b/engine/core/test-src/org/pentaho/reporting/engine/classic/core/SubReportIT.java
Thanks,
I was able to do it by :
RelationalGroup subgroup = new RelationalGroup();
GroupDataBody subgroupData = new GroupDataBody();
ItemBand itemBand = new ItemBand();
itemBand.setVisible(true);
subgroupData.setItemBand(itemBand);
subgroup.setBody(subgroupData);
subReport.setRootGroup(subgroup);
ItemBand rowBand = new ItemBand();
rowBand.setLayout(BandStyleKeys.LAYOUT_ROW);
TextFieldElementFactory subtext = new TextFieldElementFactory();
subtext.setFieldname("reportname");
subtext.setX(new Float(12.0));
subtext.setMinimumWidth(new Float(100.0));
subtext.setHeight(new Float(20.0));
Element subelement = subtext.createElement();
subelement.setDynamicContent(true);
rowBand.addElement(subelement);
TextFieldElementFactory subtext2 = new TextFieldElementFactory();
subtext2.setFieldname("reportheader");
subtext2.setX(new Float(112.0));
subtext2.setMinimumWidth(new Float(100.0));
subtext2.setHeight(new Float(20.0));
Element subelement2 = subtext2.createElement();
subelement2.setDynamicContent(true);
rowBand.addElement(subelement2);
itemBand.addElement(rowBand);
report.getReportFooter().addSubReport(subReport);
Here is my problem. After I select iten I have 4 options to click, then each options give me 4 additional final options.
So now I have command bar:
And now after I click one of buttons I want to show another command bar above the first one:
Is it possible with winRT for Windows Phone 8.1? Or maybe show some Fly Menu with icons?
like so:
here is code for adding FlyOut menu but ... when i click sendBtn everything gets grey but nothing is shown ;/
MenuFlyout testMenu = new MenuFlyout();
MenuFlyoutItem item1 = new MenuFlyoutItem();
item1.Text = "Test1";
MenuFlyoutItem item2 = new MenuFlyoutItem();
item1.Text = "Test2";
testMenu.Items.Add(item1);
testMenu.Items.Add(item2);
AppBarButton sendBtn = new AppBarButton();
sendBtn.Label = textLoader.GetString("SendToService");
sendBtn.Icon = new SymbolIcon(Symbol.Mail);
sendBtn.Flyout = testMenu;
command_bar.PrimaryCommands.Add(sendBtn);
As for your main question - there is no possiblity to make double commandbar. Though you may build your own control and implement such functionality.
As for your code - in my case it seems to work - I've tried like this:
CommandBar command_bar;
public MainPage()
{
this.InitializeComponent();
command_bar = new CommandBar();
MenuFlyout testMenu = new MenuFlyout();
MenuFlyoutItem item1 = new MenuFlyoutItem();
item1.Text = "Test1";
MenuFlyoutItem item2 = new MenuFlyoutItem();
item2.Text = "Test2";
testMenu.Items.Add(item1);
testMenu.Items.Add(item2);
AppBarButton sendBtn = new AppBarButton();
sendBtn.Label = "SendToService";
sendBtn.Icon = new SymbolIcon(Symbol.Mail);
sendBtn.Flyout = testMenu;
command_bar.PrimaryCommands.Add(sendBtn);
BottomAppBar = command_bar;
}
You have one mistake - your second MenuItem has empty label - you change the first twice.
Also if you encounter problem with bad positioning of your flyout then this answer may help.
I'm having problems to get my Windows Phone 8.1 live tile update by itself daily (around 7am)
My project has 2 parts :
a Web API project hosted on Azure that provides the tile template in XML (that part works fine)
a Windows Phone 8.1 project with a single MainPage.xaml where I build 2 square/wide tiles
When I pin my app to the start screen from the app list, my tile (whether I choose the square or wide format) flips back and forth between my 2 brands of the day just fine.
The next morning at 7:15 am, the tile won't update with the 2 new brands :(
I noticed that if I tap the tile to launch the app and come back to the start screen, the tile has updated.
It also works if I unpin and repin the tile but in both cases, that's "cheating" :-/
I call my Azure website like this to get the tile templates of both brands :
http://example.azurewebsites.net/api/tiles/0 (BRAND1)
http://example.azurewebsites.net/api/tiles/1 (BRAND2)
The XML tile template looks like this (example):
<tile>
<visual>
<binding template="TileWide310x150ImageAndText01">
<image id="1" src="http://www.example.com/sales/BRAND1/visualWide.png"/>
<text id="1">Brand 1</text>
</binding>
<binding template="TileSquare150x150PeekImageAndText04">
<image id="1" src="http://www.example.com/sales/BRAND1/visualSquare.png"/>
<text id="1">Brand 1</text>
</binding>
</visual>
</tile>
The WP8.1 page contains this :
public MainPage()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
PeriodicUpdateRecurrence recurrence = PeriodicUpdateRecurrence.Daily;
Task<string> responseBody;
for (int i = 0; i < 2; i++)
{
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri("http://xxxxx.azurewebsites.net/api/tiles/" + i); //I hid the address here for discretion
HttpResponseMessage response = httpClient.GetAsync(httpClient.BaseAddress).Result;
string statusCode = response.StatusCode.ToString();
response.EnsureSuccessStatusCode();
responseBody = response.Content.ReadAsStringAsync();
}
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(responseBody.Result);
string srcWide, srcSquare, textWide, textSquare, templateWide, templateSquare;
XElement root = XElement.Parse(responseBody.Result);
IEnumerable<XElement> wideElement = root.Descendants("binding").Where(a => a.Attribute("template").Value.ToLower().Contains("wide"));
IEnumerable<XElement> squareElement = root.Descendants("binding").Where(a => a.Attribute("template").Value.ToLower().Contains("square"));
templateWide = wideElement.Attributes("template").SingleOrDefault().Value;
srcWide = wideElement.Descendants("image").Attributes("src").SingleOrDefault().Value;
textWide = wideElement.Descendants("text").SingleOrDefault().Value;
templateSquare = squareElement.Attributes("template").SingleOrDefault().Value;
srcSquare = wideElement.Descendants("image").Attributes("src").SingleOrDefault().Value;
textSquare = wideElement.Descendants("text").SingleOrDefault().Value;
XmlDocument wideTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150ImageAndText01);
XmlNodeList wideTileTextAttributes = wideTileXml.GetElementsByTagName("text");
wideTileTextAttributes[0].InnerText = textWide;
XmlNodeList wideTileImageAttributes = wideTileXml.GetElementsByTagName("image");
((XmlElement)wideTileImageAttributes[0]).SetAttribute("src", srcWide);
((XmlElement)wideTileImageAttributes[0]).SetAttribute("alt", textWide);
XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150PeekImageAndText01);
XmlNodeList squareTileTextAttributes = squareTileXml.GetElementsByTagName("text");
squareTileTextAttributes[0].AppendChild(squareTileXml.CreateTextNode(textSquare));
XmlNodeList squareTileImageAttributes = squareTileXml.GetElementsByTagName("image");
((XmlElement)squareTileImageAttributes[0]).SetAttribute("src", srcSquare);
((XmlElement)squareTileImageAttributes[0]).SetAttribute("alt", textSquare);
IXmlNode node = wideTileXml.ImportNode(squareTileXml.GetElementsByTagName("binding").Item(0), true);
wideTileXml.GetElementsByTagName("visual").Item(0).AppendChild(node);
TileNotification tileNotification = new TileNotification(wideTileXml);
tileNotification.ExpirationTime = DateTimeOffset.UtcNow.AddDays(1).AddHours(7).AddMinutes(0);
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
}
List<Uri> urisToPoll = new List<Uri>(5);
urisToPoll.Add(new Uri("http://example.azurewebsites.net/api/tiles/0")); //fake url
urisToPoll.Add(new Uri("http://example.azurewebsites.net/api/tiles/1")); //fake url
//I want the tile to update its content every day at 7:15am
//(the Azure website supposedly returns new brands of the day at 7am)
DateTime dtTomorrow7 = DateTime.SpecifyKind(DateTime.Today.AddDays(1).AddHours(7).AddMinutes(15), DateTimeKind.Local);
DateTimeOffset dtoTomorrow7 = dtTomorrow7;
TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdateBatch(urisToPoll, dtoTomorrow7, recurrence);
}
I'm not sure I'm using the StartPeriodicUpdateBatch method correctly.
In debug mode,I can see the DateTimeOffset value is Day+1 7:15am +2:00 which looks correct but the tile does not update.
I live in France that is UTC+2
Thanks for your suggestions.
Your dtTomorrow7 is incorrect. It should just be 7:15 AM. Then it will first do an update at 7:15 AM and subsequent updates occurring at the periodic interval thereafter(you set it to daily).
Example of start time where the last TimeSpan is offset from UTC:
DateTime tomorrow = DateTime.Today.AddDays(1);
var startTime = new DateTimeOffset(tomorrow.Year, tomorrow.Month, tomorrow.Day, 7, 15, 0, TimeSpan.FromHours(2));
For my current assignment I need to make an extension for Adobe InDesign using Adobe Creative Suit Extension Builder and Flash Builder. I guess this is more of a question for ones that know Extension Builder and InDesign API.
The point of this extension is to load some data and send some data to a server. I need to make a screenshot of a page, then send it in jpg to a server. But, there are no (or at least i couldnt find any) ways to create a bitmap(to cast it on a object seems impossible, because this Objects are just Objects, and not DisplayObjects).
I managed to silently export pages as jpegs, now I'm thinking about loading them and sending but that will require building an AIR app to handle it all, so this will be a bit bulky.
So to sum up the question, how to take a screencapture of all elements on a page in InDesign using CS Ext.Builder?
what is the problem with export to JPG ? You can choose to export the page or the objects themselves.
Here is a snippet I wrote in a recent project. Hope it helps.
public static function getFilePath():String {
var app:com.adobe.indesign.Application = InDesign.app;
var sel:* = app.selection, oldResolution:Number, oldColorSpace:JpegColorSpaceEnum, groupItems:Array = [], i:int = 0, n:int = sel.length;
if (!sel || !n )
{
Alert.show("Pas de selection !", "title", Alert.OK, Sprite(mx.core.Application.application));
return "";
}
for ( i = 0 ; i < n ; i ++ )
{
groupItems [ groupItems.length ] = sel[i];
}
sel = ( sel.length > 1 )? app.activeDocument.groups.add ( sel ) : sel[0] ;
var tempFolder:File = File.createTempDirectory();
AppModel.getInstance().jpgFolder = tempFolder;
var jpgFile:File = new File ();
jpgFile.nativePath = tempFolder.nativePath + "/temp.jpg";
oldResolution = app.jpegExportPreferences.exportResolution;
app.jpegExportPreferences.exportResolution = 72;
oldColorSpace = app.jpegExportPreferences.jpegColorSpace;
app.jpegExportPreferences.jpegColorSpace = JpegColorSpaceEnum.GRAY;
sel.exportFile ( ExportFormat.jpg, jpgFile );
app.jpegExportPreferences.jpegColorSpace = oldColorSpace;
app.jpegExportPreferences.exportResolution = oldResolution;
if ( sel is Group )
{
sel.ungroup();
app.select ( groupItems );
}
return jpgFile.nativePath;
}
so.... eval() out of the question, any idea to do this? I also don't know how to use "this" expression or set() in actionscript 3 ( i seem couldn't find any complete reference on it ), just say through php file a multiple variable (test1, test2, test3,...) sent by "echo", how the flash aplication recieved it? I'm trying not to use xml on mysql to php to flash aplication. Simply how to change a string to a variable ?
example
(in as3-actions frame panel)
function datagridfill(event:MouseEvent):void{
var varfill:URLVariables = new URLVariables();
varfill.tell = "do it";
var filler:URLRequest = new URLRequest();
filler.url = "http://127.0.0.1/flashdbas3/sendin.php";
filler.data = varfill;
var filling:URLLoader = new URLLoader();
filling.dataFormat = URLLoaderDataFormat.VARIABLES;
filling.load(filler);
filling.addEventListener(Event.COMPLETE, datain);
function datain(evt:Event){
var arraygrid:Array = new Array();
testing.text = evt.target.Name2 // worked
// just say i = 1
i=1;
arraygrid.push({Name:this["evt.target.Name"+i],
Test:this.["evt.target.Test"+i]}); // error
//or
arraygrid.push({Name:this["Name"+i],
Test:this.["Test"+i]}); // error too
// eval() noexistent, set() didn't worked on actions frame panel
//?????
}
};
I hope it's very clear.
You could use this[varName] if I understand your question right.
So if varName is a variable containing a string which should be a variables name, you could set and read that variable like this:
this[varName] = "someValue";
trace(this[varName]);
Update:
In your example, you could try: evt.target["Test"+i] instead of Test:this.["evt.target.Test"+i]
If you have a set of strings that you'd like to associate with values, the standard AS3 approach is to use an object as a hash table:
var o = {}
o["test1"] = 7
o["test2"] = "fish"
print(o["test1"])