text:
categories:
- Salesforce
- Force.com
- Accelerators
- Toolkit
- NuGet
- Visual Studio
- Windows 8
date: "2014-04-25T00:00:00Z"
description: The accelerators for Windows Store apps make it easier to build new Windows
  Store apps using the Salesforce Toolkits for .NET
title: Announcing the Salesforce Accelerators for Windows Store Apps
---

Yesterday I was pleased to announce the [Salesforce Accelerators for Windows Phone 8 Apps](http://www.wadewegner.com/2014/04/Announcing-the-Windows-Phone-8-Accelerators-for-Salesforce/). Today I'm excited to tell you about the **Salesforce Accelerators for Windows Store Apps**:

* [DeveloperForce.Windows8.Login](https://www.nuget.org/packages/DeveloperForce.Windows8.Login/)
* [DeveloperForce.Windows8.Samples.Accounts](https://www.nuget.org/packages/DeveloperForce.Windows8.Samples.Accounts/)

These accelerators exist to make it easier for you to get started building Windows 8 store apps and work directly with the [Salesforce Toolkits for .NET](http://www.wadewegner.com/2014/01/announcing-the-salesforce-toolkits-for-net/). Take a look at this short video to see just how easy it is to get started.

Let's look in greater detail at how all of this works.

### Using the DeveloperForce.Windows8.Login NuGet

Using the [DeveloperForce.Windows8.Login]() NuGet is pretty straightforward and only involves a few steps.

1. Setup a **Connected App** in Salesforce ([instructions here](https://help.salesforce.com/HTViewHelpDoc?id=connected_app_create.htm&language=en_US)). Be sure to **Enable OAuth Settings**, at least choose **Full access (full)** and set the **Callback URL** to sfdc://success.

2. Install the NuGet Package via the command line ...

		Install-Package DeveloperForce.Windows8.Login

	... or using **Manage NuGet Packages** in Visual Studio. When you install this NuGet package you also get the **DeveloperForce.Force** and **DeveloperForce.Common** NuGet packages, which are defined as dependencies.

3. Open **MainPage_SFDC.xaml.cs** and change the ConsumerKey value to the one specified by your **Connected App**.

4. Open **MainPage.xaml.cs** wire up the Page_Loaded event. (You can also do this from the designer, as shown in the video.)

5. Make the MainPage_Loaded asynchronous and call the GetAccessToken method.

6. Run the application.

As you can see, using the NuGet is quite simple and takes away the guess work and trouble of setting up the user login experience. Nevertheless, it's worth noting a few things about how it all works.

* **App_SFDC.xaml.cs** is a partial class that extends the functionality of App by defining three public properties: AccessToken, RefreshToken, and InstanceUrl. These values are returned to us and set after the user logs in. Having these as public properties gives us the ability to share these around the app so that we can use them when making subsequent REST API calls.

* **MainPage_SFDC.xaml.cs** is a partial class that extends the default **MainPage.xaml.cs** through the GetAccessToken method. It contains all the logic for interacting with the WebAuthenticationBroker which manages the authentication process for Windows Store Apps.

* The GetAccessToken method first creates a set of URIs for the login process. It then initiates the WebAuthenticationBroker process by calling AuthenticateAsync. If the response comes back as a success the response URI is decoded and the AccessToken, RefreshToken, and InstanceUrl values are specified in the app variable.

* Once the login process completes the **MainPage.xaml** is loaded.

That's all it takes. After you login you'll be back on a blank **MainPage.xaml** but you'll have your AccessToken available to use when calling the Salesforce1 Platform REST APIs, which is a great transition to the **DeveloperForce.Windows8.Samples.Accounts** NuGet package accelerator.

### Using the DeveloperForce.Windows8.Samples.Accounts NuGet

An access token is worthless if you don't do anything with it.

Using the [DeveloperForce.Windows8.Samples.Accounts](https://www.nuget.org/packages/DeveloperForce.Windows8.Samples.Accounts/) NuGet makes it easy to create a page where you can query and view your account information. It is designed to demonstrate how to use the access token and instance url retrieved during the login process.

To use this NuGet, just follow these quick steps:

1. Install the NuGet Package via the command line ...

		Install-Package DeveloperForce.Windows8.Samples.Accounts

	... or using **Manage NuGet Packages** in Visual Studio.

2. After calling GetAccessToken navigate the user to the newly added **AccountsPage.xaml**.

That's it! Now run it and see it in action.

As with the previous accelerator, it will help if you know a few things about how this works. Here's the code that makes it function.

* You can see that we first set our app variables so that we can get values like AccessToken and InstanceUrl.

* Next we create an instance of the ForceClient.

* We perform an asynchronous query using a simple SOQL select statement.

* Lastly, we take the records and bind them to an accounts grid on the page.

It's as simple as that!

It is my hope that these accelerators help get you over the initial hurdles that exist when building new applications that integrate with Salesforce. As always, if you have additional ideas (or find bugs!) you can open a [new issue on Github](https://github.com/developerforce/Force.com-Toolkit-for-NET/issues) or (if you're so inclinded) take a tab at it yourself and [send me a pull request](http://help.github.com/send-pull-requests/).

I hope this helps!

redpajama_set_name: RedPajamaGithub


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bryologist 105(1): 60 (2002)

#### Original name
Sporopodium podosphaera Lücking & R. Sant.

### Remarks
null


text:
package gomarket

import (
	"github.com/garyburd/redigo/redis"
	"log"
	"strconv"
	"strings"
	"time"
)

type order interface {
	execute() bool
	cancel() bool
	record() bool
	GetSymbol() string
	GetPrice() float64
}

type Order struct {
	Symbol   string
	Quantity int64
	OrderId  int64
	Price    int64
	Time     time.Time
}

type SellOrder struct {
	Order
}

type BuyOrder struct {
	Order
}

func NewSellOrder(s string, q int64, price int64) SellOrder {
	t := time.Now()
	oid := NextOrderId(s)

	return SellOrder{Order{Symbol: s, Quantity: q, OrderId: oid, Time: t.UTC(), Price: price}}
}

func NewBuyOrder(s string, q int64) BuyOrder {
	t := time.Now()
	oid := NextOrderId(s)
	return BuyOrder{Order{Symbol: s, Quantity: q, OrderId: oid, Time: t.UTC()}}
}

func NextOrderId(symbol string) int64 {

	r := NewRedisConnection()

	id, err := redis.Int64(r.Do("INCR", redisKey(symbol+":uOrderId")))

	if err != nil {
		log.Fatal(err)
	}

	return id
}

func (o *Order) GetSymbol() string {
	return strings.ToUpper(o.Symbol)
}

func (s *SellOrder) cancel() bool {
	return true
}

func (s *SellOrder) execute() bool {
	return true
}

func (s *SellOrder) Record() error {
	r := NewRedisConnection()

	orderIdStr := strconv.FormatInt(s.OrderId, 10)

	// Add the order id to the sell orders for this symbol
	r.Send("LPUSH", redisKey(s.GetSymbol()+":orders:sell"), orderIdStr)

	// Push the order details into a hash
	r.Send("HMSET", redis.Args{}.Add(redisKey(s.GetSymbol()+":orders:sell:"+orderIdStr)).AddFlat(s))

	r.Flush()

	if _, err := r.Receive(); err != nil {
		return err
	}

	return nil
}


text:
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
  <head>
    <title layout:fragment="title">Content</title>
  </head>
  <body>
    <div layout:fragment="content">
    	<span th:text="${foo}">foo</span>
    </div>
  </body>
</html>


text:
ComputerWindow::ComputerWindow(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ComputerWindow)                          // Constructor
{
    ui->setupUi(this);
    _service = nullptr;
}
ComputerWindow::~ComputerWindow()                       // Deconstructor
{
    delete ui;
}

void ComputerWindow::set_service(service *s)            // Forwarded service
{
    _service = s;
}
void ComputerWindow::passInfo(string name)              // Forward infromation
{
    _name = name;

    _computer = _service->getComputer(_name);

    _id = _computer.getID();
    _year = _computer.getYear();
    _type = _computer.getType();

    if(_year == "0")
    {
        _year = "-";
    }

    _picurl = _computer.getPicurl();
    _about = _computer.getAbout();
    _abouturl = _computer.getAbouturl();

    ui->inputName->setText(QString::fromStdString(_name));
    ui->inputYear->setText(QString::fromStdString(_year));
    ui->inputType->setText(QString::fromStdString(_type));
    ui->inputAbout->setText(QString::fromStdString(_about));

    setImage();

    printRelations();

    ui->relationTable->setSortingEnabled(1);
    ui->inputAbout->setStyleSheet("background-color: rgba( 255, 255, 255, 0% );");
}
void ComputerWindow::setImage()                         // Set image in computer window
{
    string pixurl = "../sacr/PicCom/" + _id + ".jpg";
    QString qpixurl = QString::fromStdString(pixurl);
    QPixmap pix(qpixurl);

    ui->inputPicture->setPixmap(qpixurl);
    ui->inputPicture->setPixmap(pix.scaled(350,400,Qt::KeepAspectRatio));
}
void ComputerWindow::printRelations()                   // Print list of relation
{
    ui -> relationTable -> setSortingEnabled(1);

    ui -> relationTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

    _relations = _service->findRelation(2, _name);

    if(_relations.empty())
    {
        ui -> relationTable -> horizontalHeader() -> hide();
        ui -> relationTable -> clearContents();
        ui -> relationTable -> setRowCount(1);
        ui -> relationTable -> setColumnCount(1);
        ui -> relationTable -> setItem(0, 0, new QTableWidgetItem("No relations have been added."));
    }
    else
    {
        ui -> relationTable -> horizontalHeader();
        ui -> relationTable -> clearContents();
        ui -> relationTable -> setRowCount(_relations.size());
        ui -> relationTable -> setColumnCount(1);

        for(unsigned int row = 0; row < _relations.size(); row++)
        {
            Relation currentRelations = _relations.at(row);

            QString scientist =  QString::fromStdString(currentRelations.getScientist());

            ui -> relationTable -> setItem(row, 0, new QTableWidgetItem(scientist));
        }
    }
}
void ComputerWindow::on_buttonInfo_clicked()            // Opens website for further info
{
    QString url  = QString::fromStdString(_abouturl);
    QDesktopServices::openUrl(QUrl(url));
}
void ComputerWindow::on_buttonAddRelation_clicked()     // Opens a window to add relation
{
    AddRelationWindow addRelationWindow;
    addRelationWindow.set_service(_service);
    addRelationWindow.setComputer(QString::fromStdString(_name));
    addRelationWindow.exec();

    printRelations();
}
void ComputerWindow::on_buttonUpdate_2_clicked()        // Opens a window to update
{
    UpdateComputerWindow updateComputerWindow;
    updateComputerWindow.set_service(_service);
    updateComputerWindow.passInfo(_name);
    updateComputerWindow.exec();
    passInfo(_name);
}


text: echo "Stopping converged node: $(docker stop bbsim-converged)"