我无法在Microsoft.AspNetCore.Mvc.Controller中找到ActionContext
在我将我的版本更改为AspNetCore 1.0.0-preview1之后
这是Controller类(更改后):
并在更改之前从" Microsoft.AspNet.Mvc ":
更新前的旧方法代码:
this.Agent = ControllerInfo.Request.Headers["User-Agent"];
this.IP = ControllerInfo.HttpContext.Features.Get<IHttpConnectionFeature>()?.LocalIpAddress?.ToString();
this.RemoteIP = ControllerInfo.HttpContext.Features.Get<IHttpConnectionFeature>()?.RemoteIpAddress.ToString();
this.Refrence = ControllerInfo.ActionContext.RouteData.Values["controller"].ToString() + "/" + ControllerInfo.ActionContext.RouteData.Values["action"].ToString();
Run Code Online (Sandbox Code Playgroud) 我正在寻找一种在android(Imageview,Button或frame)中制作某种类型的倾斜视图的方法
我可以实现的任何东西点击它.
这样的Windows手机有一些风格:

或类似的东西:

屏幕的每个部分(黑线上方或下方)都是可点击的,并且可以进行新的活动.使用staggeredgridview显示具有不同列大小的网格没有问题.但我想这种方法我应该制作服装布局框架而不是网格?
我在play.google.com上找到了另一个示例:

它可以在某个地方制作一些封面和图像,但每个视图都没有onclick功能.
编辑:从Ernir部署建议:
public abstract class MainActivity extends Activity implements View.OnTouchListener {
final ImageView iv= (ImageView)findViewById(R.id.img_cut_1);
final ImageView iv2= (ImageView)findViewById(R.id.img_cut_2);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.img_cut_1).setOnTouchListener(new MyTouchListener());
}
private final class MyTouchListener implements OnTouchListener {
@Override
public boolean onTouch(View v, MotionEvent me) {
if (me.getAction() == MotionEvent.ACTION_DOWN) {
int vid = v.getId();
int nTouchX = (int)me.getX();
int nTouchY = (int)me.getY();
if (vid == R.id.img_cut_1) {
Bitmap bm = ((BitmapDrawable)iv.getDrawable()).getBitmap();
if (bm.getPixel(nTouchX, nTouchY) …Run Code Online (Sandbox Code Playgroud) 我试图将GregorianCalendar转换成波斯日历
这是我的方法:
public static DateTime GetFdate(string _Edate)
{
DateTime fdate = Convert.ToDateTime(_Edate);
GregorianCalendar gcalendar = new GregorianCalendar();
PersianCalendar pcalendar = new PersianCalendar();
DateTime fDate = gcalendar.ToDateTime(
pcalendar.GetYear(fdate),
pcalendar.GetMonth(fdate),
pcalendar.GetDayOfMonth(fdate),
pcalendar.GetHour(fdate),
pcalendar.GetMinute(fdate),
pcalendar.GetSecond(fdate), 0);
return fDate;
}
Run Code Online (Sandbox Code Playgroud)
问题是,它不适用于所有日期:
DateTime dt = GetFdate("2015-07-22 00:00:00.000");
Run Code Online (Sandbox Code Playgroud)
它给出了这个错误:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Year, Month, and Day parameters describe an un-representable DateTime.
Run Code Online (Sandbox Code Playgroud)
但对于其他日期,它的工作原理如下:
DateTime dt = GetFdate("2015-06-29 00:00:00.000");
Run Code Online (Sandbox Code Playgroud) 我在用户滚动UITableView结束后使用一种方法从网上获取新项目.
当用户点击列表末尾时我在里面调用我的提取类:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)
Run Code Online (Sandbox Code Playgroud)
为了避免ui冻结并获取,从Serve r解析新项目.
这里没有延迟,但是当我尝试在我的表中重新加载数据并添加项目时
list(reladData)有一个小的打嗝是滚动.它约为0.4或0.5秒
在此期间,滚动将被冻结.
我甚至试图使用这种方法:
dispatch_async(dispatch_get_main_queue(), ^(void)
{
[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES]
Run Code Online (Sandbox Code Playgroud)
而不是正常的reloadData,但滞后仍然是apear.
无论如何要避免这种情况,或者我应该创建消息/进度动画或其他东西
否则在这个滞后期间通知用户如"请稍候"弹出?
我试图在asp.net中获取ServerVariables ["REMOTE_ADDR"].
这是我的旧代码(webapi 2):
private Logn GLog(System.Web.Routing.RequestContext requestContext)
{
Ln Log = new LogInformation();
Lg.IP = requestContext.HttpContext.Request.ServerVariables["REMOTE_ADDR"];
Lg.RemoteIP = requestContext.HttpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
............................
Run Code Online (Sandbox Code Playgroud)
从我所学到的,他们将" Routing.RequestContext " 更改为
vNext版本中的" IHttpContextAccessor ".
我怎么能用IHttpContextAccessor获得上述结果?
这给了我" ServerVariables "部分的错误:
private Logn GLog(IHttpContextAccessor requestContext)
{
Ln Log = new LogInformation();
Lg.IP = requestContext.HttpContext.Request.ServerVariables["REMOTE_ADDR"];
}
Run Code Online (Sandbox Code Playgroud) 我可以使用此代码执行此操作:
[HttpPost("SampleRoute1")]
public JsonResult Post([FromBody]SampleModel1 value)
{
.....Functionone.....
return Json("");
}
[HttpPost("SampleRoute2")]
public JsonResult Post([FromBody]SampleModel2 value)
{
.....Functiontwo.....
return Json("");
}
Run Code Online (Sandbox Code Playgroud)
但我不能这样做:
[HttpPost("SampleRoute1")]
public JsonResult Post([FromBody]SampleModel1 value)
{
.....Functionone.....
return Json("");
}
[HttpPost("SampleRoute2")]
public JsonResult Post([FromBody]SampleModel1 value)
{
.....Functiontwo.....
return Json("");
}
Run Code Online (Sandbox Code Playgroud)
它给出错误" 类型''Controller1'已经定义了一个名为'Post'的成员,它具有相同的参数类型 "
那么有什么方法可以让一个控制器中的两个Post具有相同的参数但具有不同的路径?
像这样 :
发布(SampleModel1)=>"Controller1\SampleRoute1"=>执行Function1
发布(SampleModel1)=>"Controller1\SampleRoute2"=>执行Function2
我正在尝试通过滑行找出 gif 的结尾。
这是我在网上找到的代码:
Glide.with(thisActivity).asGif().load(R.raw.logo_gif_motion_low).listener(object : RequestListener<GifDrawable> {
override fun onLoadFailed(p0: GlideException?, p1: Any?, p2: Target<GifDrawable>, p3: Boolean): Boolean {
}
override fun onResourceReady(p0: GifDrawable?, p1: Any?, p2: Target<GifDrawable>, p3: DataSource?, p4: Boolean): Boolean {
return false
}
}).into(splashscreen);
Run Code Online (Sandbox Code Playgroud)
问题是,它不接受GifDrawable的目标。
错误说:
我正在尝试从 fxml 文件填充示例 javafx TableView。
这是我的控制器方法:
public class TestController implements Initializable {
@FXML private TableView<user> tableView;
@FXML private TableColumn<user, String> UserId;
@FXML private TableColumn<user, String> UserName;
public void initialize(URL location, ResourceBundle resources) {
UserId.setCellValueFactory(new PropertyValueFactory<user, String>("userId"));
UserName.setCellValueFactory(new PropertyValueFactory<user, String>("userName"));
tableView.getItems().setAll(parseUserList());
}
private List<user> parseUserList(){
List<user> l_u = new ArrayList<user>();
user u = new user();
u.setUserId(1);
u.setUserName("test1");
l_u.add(u);
u.setUserId(2);
u.setUserName("test2");
l_u.add(u);
u.setUserId(3);
u.setUserName("test3");
l_u.add(u);
return l_u;
}
}
Run Code Online (Sandbox Code Playgroud)
和 fxml 文件:
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="369.0" prefWidth="505.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="viewmodel.TestController …Run Code Online (Sandbox Code Playgroud) 我在我的ios程序中使用谷歌分析来获取用户事件.
这是我在我的视图中捕获用户交互的代码:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
NSString* uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:@"&uid"
value:uniqueIdentifier];
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"CategoryVisit"
action:@"CategoryName"
label:self.catname
value:self.code] build]];
}
Run Code Online (Sandbox Code Playgroud)
现在如何根据事件值过滤管理面板?只有"动作,类别,标签"的过滤器.

也有可能的方法过滤基于uid ???
c# ×3
android ×2
asp.net-core ×2
asp.net ×1
asp.net-mvc ×1
dnx ×1
ios ×1
java ×1
javafx ×1
objective-c ×1
openjfx ×1
uitableview ×1