本文整理汇总了C#中ActivityType类的典型用法代码示例。如果您正苦于以下问题:C# ActivityType类的具体用法?C# ActivityType怎么用?C# ActivityType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivityType类属于命名空间,在下文中一共展示了ActivityType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Activity
public Activity(string name, string path, string args, string t)
{
_name = name;
_pathfile = path;
_argument = args;
if (t.CompareTo("Wallpaper") == 0)
{
_type = ActivityType.Wallpaper;
}
else
{
if (t.CompareTo("ExeFile") == 0)
{
_type = ActivityType.ExeFile;
}
else
{
if (t.CompareTo("BatchFile") == 0)
{
_type = ActivityType.BatchFile;
}
}
}
}
示例2: LoadActivityInf
public void LoadActivityInf(int id)
{
#region 加载活动信息
ActivityInfo actInfo = Activities.GetActivityInfo(id);
act_title.Text = actInfo.Atitle;
postdatetimeStart.SelectedDate = Convert.ToDateTime(actInfo.Begintime);
postdatetimeEnd.SelectedDate = Convert.ToDateTime(actInfo.Endtime);
act_style.Text = actInfo.Stylecode;
act_script.Text = actInfo.Scriptcode;
templatenew.Text = actInfo.Desccode;
seotitle.Text = actInfo.Seotitle;
seokeyword.Text = actInfo.Seokeyword;
seodesc.Text = actInfo.Seodesc;
act_status.SelectedValue = actInfo.Enabled.ToString();
act_rssimg.Text = actInfo.RssImg;
ActivityType ate = new ActivityType();
typeid.Items.Clear();
typeid.Items.Add(new ListItem("全部", "0"));
foreach (string atname in Enum.GetNames(ate.GetType()))
{
int s_value = Convert.ToInt16(Enum.Parse(ate.GetType(), atname));
string s_text = EnumCatch.GetActivityType(s_value);
typeid.Items.Add(new ListItem(s_text, s_value.ToString()));
}
typeid.SelectedValue = actInfo.Atype.ToString();
#endregion
}
示例3: IsAccessAllowed
public static bool IsAccessAllowed(string Controller, string Action, CustomPrincipal User, string IP, ActivityType activity)
{
IMenuService menuService = UnityConfigurator.GetConfiguredContainer().Resolve<IMenuService>();
if (User != null)
{
//default controller for all user
if (Controller.ToLower().Contains("account") || Controller.ToLower().Contains("home"))
{
return true;
}
else
{
bool allowed = false;
//check if user have access to controller
//ensure that 1 form/modul = 1 controller
allowed = menuService.isAccessAllowed(Controller, User.RoleId);
//if activity type is supplied, check the activity permission too
if (activity != ActivityType.None)
{
allowed = allowed && menuService.isAccessAllowed(Controller, activity.ToString(), User.RoleId);
}
return allowed;
}
}
else
{
return false;
}
}
示例4: ActivityTypeDoesNotSaveWithIndicatorWith1Character
public void ActivityTypeDoesNotSaveWithIndicatorWith1Character()
{
//Invalid Indicator
var activityType = new ActivityType
{
ActivityCategory = ActivityCategory,
Indicator = "1",
Name = ValidValueName
};
try
{
using (var ts = new TransactionScope())
{
_activityTypeRepository.EnsurePersistent(activityType);
ts.CommitTransaction();
}
}
catch (Exception)
{
var results = activityType.ValidationResults().AsMessageList();
Assert.AreEqual(1, results.Count);
results.AssertContains("Indicator: length must be between 2 and 2");
//Assert.AreEqual("Object of type FSNEP.Core.Domain.ActivityType could not be persisted\n\n\r\nValidation Errors: Indicator, The length of the value must fall within the range \"2\" (Inclusive) - \"2\" (Inclusive).\r\n", message.Message, "Expected Exception Not encountered");
throw;
}
}
示例5: GetUserActivities
public ActivitiesResponse GetUserActivities(int page, int count, ActivityType type)
{
EnsureIsAuthorized();
var parameters = BuildPagingParametersWithCount(page, count);
if (type != ActivityType.All) parameters.Add("type", type.ToString().ToLower());
return _restTemplate.GetForObject<ActivitiesResponse>(BuildUrl("user/activity", parameters));
}
示例6: PutActivityType
// PUT api/ActivityTypes/5
public HttpResponseMessage PutActivityType(int id, ActivityType activitytype)
{
if (!ModelState.IsValid)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
}
if (id != activitytype.Id)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
db.Entry(activitytype).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException ex)
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
}
return Request.CreateResponse(HttpStatusCode.OK);
}
示例7: InitializeComponent
private void InitializeComponent()
{
AddBrandInfo.Click += new EventHandler(AddBrandInfo_Click);
ActivityType ate = new ActivityType();
brandclass.BuildTree(tpb.GetAllCategoryList(), "name", "cid");
}
示例8: WorkPackage
public WorkPackage(UInt64 Id,
String Name,
ActivityType ActivityType,
UInt32 StartMonth,
UInt32 EndMonth,
Double Force,
IGenericPropertyGraph<UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object,
UInt64, Int64, String, String, Object> Graph)
{
this.Id = Id;
this.Name = Name;
this.StartMonth = StartMonth;
this.Graph = Graph;
this.Vertex = Graph.AddVertex(v => v.SetProperty("Id_", Id).
SetProperty("Name", Name).
SetProperty("Type", "WorkPackage").
SetProperty("ActivityType", ActivityType).
SetProperty("StartMonth", StartMonth).
SetProperty("EndMonth", EndMonth).
SetProperty("Force", Force).
SetProperty("class", this));
}
示例9: Score
/// <summary>
/// Creates a score for a game level or quiz
/// </summary>
/// <param name="p">The Player Name</param>
/// <param name="t">The Activity Type</param>
/// <param name="s"></param>
/// <param name="title"></param>
public Score(String p, ActivityType t, int s, String title)
{
_date = DateTime.Now;
Value = s;
Type = t;
PlayerName = p;
ItemTitle = title;
}
示例10: ActivityBase
protected ActivityBase(IGameLog log, Player player, string message, ActivityType type)
{
Log = log;
Player = player;
Message = message;
Type = type;
Id = Guid.NewGuid();
}
示例11: ActivityTypeGetResponse
internal ActivityTypeGetResponse(
CoreRegistrationModel.ActivityTypeGetResponse internalResponse,
DataFactoryManagementClient client)
: this()
{
DataFactoryOperationUtilities.CopyRuntimeProperties(internalResponse, this);
this.ActivityType =
((ActivityTypeOperations)client.ActivityTypes).Converter.ToWrapperType(internalResponse.ActivityType);
}
示例12: Explore
public async Task<List<SegmentSummary>> Explore(LatLng southWest, LatLng northEast, ActivityType activityType = ActivityType.Ride)
{
var request = new RestRequest(EndPoint + "/explore", Method.GET);
request.AddParameter("bounds",
string.Format("{0},{1},{2},{3}", southWest.Latitude.ToString(CultureInfo.InvariantCulture), southWest.Longitude.ToString(CultureInfo.InvariantCulture),
northEast.Latitude.ToString(CultureInfo.InvariantCulture), northEast.Longitude.ToString(CultureInfo.InvariantCulture)));
var response = await _client.RestClient.Execute<SegmentCollection>(request);
return response.Data.Segments;
}
示例13: UploadActivityAsync
/// <summary>
/// Uploads an activity.
/// </summary>
/// <param name="file">The path to the activity file on your local hard disk.</param>
/// <param name="dataFormat">The format of the file.</param>
/// <param name="activityType">The type of the activity.</param>
/// <returns>The status of the upload.</returns>
public async Task<UploadStatus> UploadActivityAsync(StorageFile file, DataFormat dataFormat, ActivityType activityType = ActivityType.Ride)
{
String format = String.Empty;
switch (dataFormat)
{
case DataFormat.Fit:
format = "fit";
break;
case DataFormat.FitGZipped:
format = "fit.gz";
break;
case DataFormat.Gpx:
format = "gpx";
break;
case DataFormat.GpxGZipped:
format = "gpx.gz";
break;
case DataFormat.Tcx:
format = "tcx";
break;
case DataFormat.TcxGZipped:
format = "tcx.gz";
break;
}
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", String.Format("Bearer {0}", Authentication.AccessToken));
MultipartFormDataContent content = new MultipartFormDataContent();
byte[] fileBytes = null;
using (IRandomAccessStreamWithContentType stream = await file.OpenReadAsync())
{
fileBytes = new byte[stream.Size];
using (DataReader reader = new DataReader(stream))
{
await reader.LoadAsync((uint)stream.Size);
reader.ReadBytes(fileBytes);
}
}
var byteArrayContent = new ByteArrayContent(fileBytes);
content.Add(byteArrayContent, "file", file.Name);
HttpResponseMessage result = await client.PostAsync(
String.Format("https://www.strava.com/api/v3/uploads?data_type={0}&activity_type={1}",
format,
activityType.ToString().ToLower()),
content);
String json = await result.Content.ReadAsStringAsync();
return Unmarshaller<UploadStatus>.Unmarshal(json);
}
示例14: CreateActivityAsync
/// <summary>
/// Creates a manual entry on Strava.
/// </summary>
/// <param name="name">The name of the activity.</param>
/// <param name="type">The type of the activity.</param>
/// <param name="dateTime">The time when the activity was started.</param>
/// <param name="elapsedSeconds">The elapsed time in seconds.</param>
/// <param name="description">The description (otpional).</param>
/// <param name="distance">The distance of the activity (optional).</param>
public async Task<Activity> CreateActivityAsync(String name, ActivityType type, DateTime dateTime, int elapsedSeconds, String description, float distance = 0f)
{
String t = type.ToString().ToLower();
String timeString = dateTime.ToString("o");
String postUrl = String.Format("https://www.strava.com/api/v3/activities?name={0}&type={1}&start_date_local={2}&elapsed_time={3}&description={4}&distance={5}&access_token={6}",
name, t, timeString, elapsedSeconds, description, distance.ToString(CultureInfo.InvariantCulture), Authentication.AccessToken);
String json = await Http.WebRequest.SendPostAsync(new Uri(postUrl));
return Unmarshaller<Activity>.Unmarshal(json);
}
示例15: GetActvitiesByType
/// <summary>
/// 根据类型获取活动信息
/// </summary>
/// <param name="nums"></param>
/// <param name="atype"></param>
public static List<ActivityInfo> GetActvitiesByType(int nums, ActivityType atype)
{
List<ActivityInfo> actlist = new List<ActivityInfo>();
IDataReader reader = DatabaseProvider.GetInstance().GetActvitiesByType(nums, atype);
while (reader.Read())
{
actlist.Add(LoadSingleActivityInfo(reader));
}
reader.Close();
return actlist;
}