Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apress
committed
Oct 16, 2016
0 parents
commit f9644f0
Showing
530 changed files
with
34,229 additions
and
0 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<%@ Page Language="C#" masterpagefile="~masterurl/default.master" title="Untitled 1" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" meta:webpartpageexpansion="full" %> | ||
<asp:Content id="Content1" runat="server" contentplaceholderid="PlaceHolderMain"> | ||
<script type="text/javascript"> | ||
ExecuteOrDelayUntilScriptLoaded(MainFunction, "sp.js"); | ||
var objContext = null; | ||
var objWeb = null | ||
var objList = null; | ||
var objItem = null; | ||
var objListItemCreationInfo = null; | ||
function MainFunction() | ||
{ | ||
} | ||
function AddItem() | ||
{ | ||
var strTitle = document.getElementById('txtTitle').value; | ||
var strPrice = document.getElementById('txtPrice').value; | ||
objContext = new SP.ClientContext.get_current(); | ||
objWeb = objContext.get_web(); | ||
objList = objWeb.get_lists().getByTitle("Product"); | ||
objListItemCreationInfo = new SP.ListItemCreationInformation(); | ||
objItem = objList.addItem(objListItemCreationInfo); | ||
objItem.set_item('Title', strTitle); | ||
objItem.set_item('Price', strPrice); | ||
objItem.update(); | ||
objContext.load(objItem); | ||
objContext.executeQueryAsync(Function.createDelegate(this, this.AddItemSuccess), Function.createDelegate(this, this.AddItemFail)); | ||
document.getElementById('txtTitle').value = ''; | ||
document.getElementById('txtPrice').value = ''; | ||
} | ||
function AddItemSuccess(sender, args) | ||
{ | ||
alert('Item added successfully.'); | ||
} | ||
function AddItemFail(sender, args) | ||
{ | ||
alert('Item is not added.'); | ||
} | ||
</script> | ||
|
||
<table style="width: 100%"> | ||
<tr> | ||
<td>Title</td> | ||
<td><input id="txtTitle" name="txtTitle" type="text" /></td> | ||
</tr> | ||
<tr> | ||
<td>Price</td> | ||
<td><input id="txtPrice" name="txtPrice" type="text" /></td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td><input name="btnAdd" type="button" value="Add" onclick="javascript:AddItem();"/></td> | ||
</tr> | ||
</table> | ||
|
||
</asp:Content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<%@ Page Language="C#" masterpagefile="~masterurl/default.master" title="Untitled 1" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" meta:webpartpageexpansion="full" %> | ||
<asp:Content id="Content1" runat="server" contentplaceholderid="PlaceHolderMain"> | ||
<script type="text/javascript"> | ||
ExecuteOrDelayUntilScriptLoaded(MainFunction, "sp.js"); | ||
var strID = null; | ||
var objContext = null; | ||
var objWeb = null | ||
var objList = null; | ||
var objItem = null; | ||
var objCollectionListItem = null; | ||
function MainFunction() | ||
{ | ||
strID = QueryString("ID"); | ||
objContext = new SP.ClientContext.get_current(); | ||
objWeb = objContext.get_web(); | ||
objList = objWeb.get_lists().getByTitle("Product"); | ||
var objQuery = new SP.CamlQuery(); | ||
objQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name="ID"/><Value Type="Number">'+ strID +'</Value></Eq></Where></Query><ViewFields><FieldRef Name="Title"/><FieldRef Name="Price"/></ViewFields></View>'); | ||
objCollectionListItem = objList.getItems(objQuery); | ||
objContext.load(objCollectionListItem); | ||
objContext.executeQueryAsync(Function.createDelegate(this, this.LoadItemSuccess), Function.createDelegate(this, this.LoadItemFail)); | ||
} | ||
function LoadItemSuccess(sender, args) | ||
{ | ||
var listItemEnumerator = objCollectionListItem.getEnumerator(); | ||
//This loop will run only once | ||
while (listItemEnumerator.moveNext()) | ||
{ | ||
var objTempItem = listItemEnumerator.get_current(); | ||
document.getElementById('txtTitle').value = objTempItem.get_item('Title'); | ||
document.getElementById('txtPrice').value = objTempItem.get_item('Price'); | ||
} | ||
} | ||
function LoadItemFail(sender, args) | ||
{ | ||
alert('Item loading failed.'); | ||
} | ||
function QueryString(parameter) | ||
{ | ||
var loc = location.search.substring(1, location.search.length); | ||
var param_value = false; | ||
var params = loc.split("&"); | ||
for (i=0; i<params.length;i++) | ||
{ | ||
param_name = params[i].substring(0,params[i].indexOf('=')); | ||
if (param_name == parameter) | ||
{ | ||
param_value = params[i].substring(params[i].indexOf('=')+1) | ||
} | ||
} | ||
if (param_value) | ||
{ | ||
return param_value; | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
function UpdateItem() | ||
{ | ||
var strTitle = document.getElementById('txtTitle').value; | ||
var strPrice = document.getElementById('txtPrice').value; | ||
objContext = new SP.ClientContext.get_current(); | ||
objWeb = objContext.get_web(); | ||
objList = objWeb.get_lists().getByTitle("Product"); | ||
objItem = objList.getItemById(strID); | ||
objItem.set_item('Title', strTitle); | ||
objItem.set_item('Price', strPrice); | ||
objItem.update(); | ||
objContext.executeQueryAsync(Function.createDelegate(this, this.UpdateItemSuccess), Function.createDelegate(this, this.UpdateItemFail)); | ||
document.getElementById('txtTitle').value = ''; | ||
document.getElementById('txtPrice').value = ''; | ||
} | ||
function UpdateItemSuccess(sender, args) | ||
{ | ||
alert('Item updated successfully.'); | ||
} | ||
function UpdateItemFail(sender, args) | ||
{ | ||
alert('Item is not updated.'); | ||
} | ||
function DeleteItem() | ||
{ | ||
if(window.confirm('Are you sure you want to delete this item?')) | ||
{ | ||
objContext = new SP.ClientContext.get_current(); | ||
objWeb = objContext.get_web(); | ||
objList = objWeb.get_lists().getByTitle("Product"); | ||
objItem = objList.getItemById(strID); | ||
objItem.deleteObject(); | ||
objContext.executeQueryAsync(Function.createDelegate(this, this.DeleteItemSuccess), Function.createDelegate(this, this.DeleteItemFail)); | ||
} | ||
} | ||
function DeleteItemSuccess(sender, args) | ||
{ | ||
window.location = "AllItems.aspx"; | ||
} | ||
function DeleteItemFail(sender, args) | ||
{ | ||
alert('Item is not updated.'); | ||
} | ||
</script> | ||
|
||
<table style="width: 100%"> | ||
<tr> | ||
<td>Title</td> | ||
<td><input id="txtTitle" name="txtTitle" type="text" /></td> | ||
</tr> | ||
<tr> | ||
<td>Price</td> | ||
<td><input id="txtPrice" name="txtPrice" type="text" /></td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td><input name="btnUpdate" type="button" value="Update" onclick="javascript:UpdateItem();"/> | ||
<input name="btnDelete" type="button" value="Delete" onclick="javascript:DeleteItem();"/></td> | ||
</tr> | ||
</table> | ||
|
||
</asp:Content> |
19 changes: 19 additions & 0 deletions
19
Exp_SP_2010_Practices/Ch11/Apress.SharePoint.WP7.MyLinks.Finish/App.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Application | ||
x:Class="Apress.SharePoint.WP7.MyLinks.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" | ||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"> | ||
|
||
<!--Application Resources--> | ||
<Application.Resources> | ||
</Application.Resources> | ||
|
||
<Application.ApplicationLifetimeObjects> | ||
<!--Required object that handles lifetime events for the application--> | ||
<shell:PhoneApplicationService | ||
Launching="Application_Launching" Closing="Application_Closing" | ||
Activated="Application_Activated" Deactivated="Application_Deactivated"/> | ||
</Application.ApplicationLifetimeObjects> | ||
|
||
</Application> |
141 changes: 141 additions & 0 deletions
141
Exp_SP_2010_Practices/Ch11/Apress.SharePoint.WP7.MyLinks.Finish/App.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Animation; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using Microsoft.Phone.Controls; | ||
using Microsoft.Phone.Shell; | ||
|
||
namespace Apress.SharePoint.WP7.MyLinks | ||
{ | ||
public partial class App : Application | ||
{ | ||
/// <summary> | ||
/// Provides easy access to the root frame of the Phone Application. | ||
/// </summary> | ||
/// <returns>The root frame of the Phone Application.</returns> | ||
public PhoneApplicationFrame RootFrame { get; private set; } | ||
|
||
/// <summary> | ||
/// Constructor for the Application object. | ||
/// </summary> | ||
public App() | ||
{ | ||
// Global handler for uncaught exceptions. | ||
UnhandledException += Application_UnhandledException; | ||
|
||
// Show graphics profiling information while debugging. | ||
if (System.Diagnostics.Debugger.IsAttached) | ||
{ | ||
// Display the current frame rate counters. | ||
Application.Current.Host.Settings.EnableFrameRateCounter = true; | ||
|
||
// Show the areas of the app that are being redrawn in each frame. | ||
//Application.Current.Host.Settings.EnableRedrawRegions = true; | ||
|
||
// Enable non-production analysis visualization mode, | ||
// which shows areas of a page that are being GPU accelerated with a colored overlay. | ||
//Application.Current.Host.Settings.EnableCacheVisualization = true; | ||
} | ||
|
||
// Standard Silverlight initialization | ||
InitializeComponent(); | ||
|
||
// Phone-specific initialization | ||
InitializePhoneApplication(); | ||
} | ||
|
||
// Code to execute when the application is launching (eg, from Start) | ||
// This code will not execute when the application is reactivated | ||
private void Application_Launching(object sender, LaunchingEventArgs e) | ||
{ | ||
} | ||
|
||
// Code to execute when the application is activated (brought to foreground) | ||
// This code will not execute when the application is first launched | ||
private void Application_Activated(object sender, ActivatedEventArgs e) | ||
{ | ||
} | ||
|
||
// Code to execute when the application is deactivated (sent to background) | ||
// This code will not execute when the application is closing | ||
private void Application_Deactivated(object sender, DeactivatedEventArgs e) | ||
{ | ||
} | ||
|
||
// Code to execute when the application is closing (eg, user hit Back) | ||
// This code will not execute when the application is deactivated | ||
private void Application_Closing(object sender, ClosingEventArgs e) | ||
{ | ||
} | ||
|
||
// Code to execute if a navigation fails | ||
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) | ||
{ | ||
if (System.Diagnostics.Debugger.IsAttached) | ||
{ | ||
// A navigation has failed; break into the debugger | ||
System.Diagnostics.Debugger.Break(); | ||
} | ||
} | ||
|
||
// Code to execute on Unhandled Exceptions | ||
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) | ||
{ | ||
if (System.Diagnostics.Debugger.IsAttached) | ||
{ | ||
// An unhandled exception has occurred; break into the debugger | ||
System.Diagnostics.Debugger.Break(); | ||
} | ||
} | ||
|
||
#region Phone application initialization | ||
|
||
// Avoid double-initialization | ||
private bool phoneApplicationInitialized = false; | ||
|
||
// Do not add any additional code to this method | ||
private void InitializePhoneApplication() | ||
{ | ||
if (phoneApplicationInitialized) | ||
return; | ||
|
||
// Create the frame but don't set it as RootVisual yet; this allows the splash | ||
// screen to remain active until the application is ready to render. | ||
RootFrame = new PhoneApplicationFrame(); | ||
RootFrame.Navigated += CompleteInitializePhoneApplication; | ||
|
||
// Handle navigation failures | ||
RootFrame.NavigationFailed += RootFrame_NavigationFailed; | ||
|
||
// Ensure we don't initialize again | ||
phoneApplicationInitialized = true; | ||
} | ||
|
||
// Do not add any additional code to this method | ||
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) | ||
{ | ||
// Set the root visual to allow the application to render | ||
if (RootVisual != RootFrame) | ||
RootVisual = RootFrame; | ||
|
||
// Remove this handler since it is no longer needed | ||
RootFrame.Navigated -= CompleteInitializePhoneApplication; | ||
} | ||
|
||
#endregion | ||
|
||
//storage for Authenitcation requirements | ||
|
||
//TODO: Cookie Property Here | ||
public static CookieContainer Cookies { get; set; } | ||
|
||
} | ||
} |
Binary file added
BIN
+1.84 KB
...SP_2010_Practices/Ch11/Apress.SharePoint.WP7.MyLinks.Finish/ApplicationIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.