map improvement

user picture
image crop
This commit is contained in:
2011-03-31 06:24:59 +03:00
parent 833083ca0e
commit c0d31a8652
65 changed files with 3128 additions and 41 deletions
+7
View File
@@ -41,6 +41,13 @@ namespace MyFriendsAround.Web
protected void Application_Start()
{
//setup azure
Microsoft.WindowsAzure.CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
{
configSetter(Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(configName));
});
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
@@ -56,6 +56,9 @@
<HintPath>..\Libs\Sql\Microsoft.SqlServer.Types.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
@@ -97,6 +100,7 @@
<DependentUpon>myfriends.svc</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebRole.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Global.asax" />
+9
View File
@@ -16,6 +16,8 @@
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="takeTopFriends" value="20" />
<add key="azureProfilesContainer" value="profiles"/>
<add key="profileImageFormat" value="profile_{0}.jpg"/>
</appSettings>
<system.web>
@@ -98,5 +100,12 @@
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding maxBufferSize="965536" maxBufferPoolSize="965536" maxReceivedMessageSize="965536">
<readerQuotas maxStringContentLength="965536"/>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
+61
View File
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
namespace MyFriendsAround.Web
{
public class WebRole : RoleEntryPoint
{
private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs args)
{
}
public override bool OnStart()
{
DiagnosticMonitor.Start("DataConnectionString");
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
#region Setup CloudStorageAccount Configuration Setting Publisher
// This code sets up a handler to update CloudStorageAccount instances when their corresponding
// configuration settings change in the service configuration file.
CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
{
// Provide the configSetter with the initial value
configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
RoleEnvironment.Changed += (sender, arg) =>
{
if (arg.Changes.OfType<RoleEnvironmentConfigurationSettingChange>()
.Any((change) => (change.ConfigurationSettingName == configName)))
{
// The corresponding configuration setting has changed, propagate the value
if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
{
// In this case, the change to the storage account credentials in the
// service configuration is significant enough that the role needs to be
// recycled in order to use the latest settings. (for example, the
// endpoint has changed)
RoleEnvironment.RequestRecycle();
}
}
};
});
#endregion
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
RoleEnvironment.Changing += RoleEnvironmentChanging;
return base.OnStart();
}
}
}
+3 -3
View File
@@ -30,7 +30,7 @@ namespace MyFriendsAround.Web
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public List<Friend> GetFriends(int skip)
public List<Friend> GetFriendsSkip(int skip)
{
int take = Convert.ToInt32(WebConfigurationManager.AppSettings["takeTopFriends"]);
return FriendsRepository.GetFriends(skip, take);
@@ -46,9 +46,9 @@ namespace MyFriendsAround.Web
[OperationContract]
[WebInvoke(ResponseFormat = WebMessageFormat.Json, Method = "POST")]
public bool UpdatePicture(string userId, byte[] userPicture)
public bool UpdatePicture(PictureInfo pictureInfo)
{
return FriendsRepository.UpdatePicture(userId, userPicture);
return FriendsRepository.UpdatePicture(pictureInfo.UserId, Convert.FromBase64String(pictureInfo.Picture));
}
}