我已经创建了一个WIA包装器,我相信它对某些人有用.它仍然处于开发阶段,但除了HasNextPage方法不起作用之外,它都有效.我从很多不同的来源获取了代码.但基本上,在我的代码中,如果ADF中没有页面,WIA.Properties不会改变,所以它总是认为还有另一个页面?我可以做一个草率(尝试捕获,如果没有纸张错误,但这非常草率)
有任何想法吗?
继承我的代码:
ps - 我不介意批评编码标准,请评论任何能让我成为更好程序员的东西:)
(我有几行代码可供尝试和调试)主要问题是,无论我做什么,文档处理状态都不会改变
public struct PageSize
{
public double Height;
public double Width;
public PageSize(double height, double width)
{
this.Height = height;
this.Width = width;
}
}
class WIA_PROPERTIES
{
public const uint WIA_RESERVED_FOR_NEW_PROPS = 1024;
public const uint WIA_DIP_FIRST = 2;
public const uint WIA_DPA_FIRST = WIA_DIP_FIRST + WIA_RESERVED_FOR_NEW_PROPS;
public const uint WIA_DPC_FIRST = WIA_DPA_FIRST + WIA_RESERVED_FOR_NEW_PROPS;
//
// Scanner only device properties (DPS)
//
public const uint WIA_DPS_FIRST = WIA_DPC_FIRST + WIA_RESERVED_FOR_NEW_PROPS;
public const …Run Code Online (Sandbox Code Playgroud) 我有一个文本框,当我对焦时,我希望光标转到文本框的末尾.
不断涌现的解决方案就是
this.value = this.value
Run Code Online (Sandbox Code Playgroud)
我用一个简单的方法尝试了这个:
function InputClicked(element) {
element.className = "inputfocused";
element.value = element.value;
}
Run Code Online (Sandbox Code Playgroud)
但奇怪的是这个,它似乎转到结束然后跳到文本框的开头.
我有一个MVC C#Controller,它返回一个FileResult
[HttpPost]
public FileResult FinaliseQuote(string quote)
{
var finalisedQuote = JsonConvert.DeserializeObject<FinalisedQuote>(System.Uri.UnescapeDataString(quote));
return File(finalisedQuote.ConvertToPdf(), "application/pdf");
}
Run Code Online (Sandbox Code Playgroud)
现在我希望能够下载结果(我不希望它在浏览器中打开)我通过JavaScript中的$ .ajax方法调用控制器
var postData = { quote: finalisedQuote };
var url = "/NewQuote/FinaliseQuote";
$.ajax({
type: "POST",
url: url,
data: postData,
success: function (data) {
//how do I handle data to force download
},
fail: function (msg) {
alert(msg)
},
datatype: "json"
});
Run Code Online (Sandbox Code Playgroud)
如何处理数据以强制下载?
我有一个网页,它为同一个应用程序使用多个URL:
例如:*.MyWebPage.com.au*.YourWebPage.com.au
因此它将在多个网址上使用子域名.问题是我需要允许用户在他们登录的URL的所有子域上进行身份验证.
例如,如果他们通过www.mywebpage.com.au登录,则需要为*.mywebpage.com.au设置cookie,或者如果他们通过www.yourwebpage.com.au登录,则cookie应为*.yourwebpage.com. AU.
允许ASP.NET核心标识的子域的大多数文档都指向startup.cs(或startup.auth.cs)文件并输入如下内容:
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
CookieDomain = "mywebpage.com.au"
});`
Run Code Online (Sandbox Code Playgroud)
这对我不起作用,因为我不想要一个固定的域名,我只想让所有用户都可以访问他们登录的URL的所有子域名.我可以通过请求显然在登录时获取他们的URL,但我需要动态设置cookiedomain.
我创建了一个C#Webform程序,用于在我的网页上向客户发送提醒电子邮件.
它在Outlook中运行良好.在FireFox上的Gmail中.
我刚刚发现(我不使用IE)在IE 8中的gmail中它不显示图像?
它只有一个X和alt文本.
我无法弄清楚为什么IE 8和gmail不会显示图像,我已经玩了一下.
在C#中:
LinkedResource emo2 = new LinkedResource(logoPath);
emo2.ContentId = "logo";
emo2.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
htmlView.LinkedResources.Add(emo2);
Run Code Online (Sandbox Code Playgroud)
在我的HTML文件中:
<img id="header" alt="MyWebpage" src="cid:logo" />
Run Code Online (Sandbox Code Playgroud)
通过电子邮件发送简报对所有不同的客户来说都是令人沮丧的.但我从没想过Gmail会成为我的问题!
我正在使用 ASP.NET Core 及其内置依赖项注入和 asp.net 身份。
我遇到的问题是,每当我尝试通过异步访问任何上下文(即在本例中UserManager<ApplicationUser>)时,它都会在访问时被释放。
比如我的控制器如下(我们关心的对象是UserManager)
private readonly ApplicationDbContext _dbContext;
private readonly UserManager<ApplicationUser> _userManager;
private readonly ViewRender _view;
private readonly IConfiguration _config;
public UserController(ApplicationDbContext dbContext,
UserManager<ApplicationUser> userManager,
ViewRender view,
IConfiguration config)
{
this._dbContext = dbContext;
this._userManager = userManager;
this._view = view;
this._config = config;
}
Run Code Online (Sandbox Code Playgroud)
请注意,_userManager正在使用startup.cs中的Visual Studio模板默认设置进行注入
现在,在此控制器中的方法中,我尝试以下操作:
[HttpDelete]
public async void Delete(string id)
{
var user = _userManager.Users.Where(a => a.Id == id).FirstOrDefault();
user.Deleted = true;
var result= await _userManager.UpdateAsync(user);
}
Run Code Online (Sandbox Code Playgroud)
但是当 …
我正在使用Windows + Visual Studio代码来开发Node JS API。我正在使用Axios将来自NodeJ的其余请求提交给第三方API。
我想检查通过Fiddler从我的节点服务器发送到第三方后端的数据包,但是我一直很难让Axios通过127.0.0.1端口8888进行代理。
理想情况下,将其设置为打开/关闭代理将是一个简单的全局变量。我尝试过的是:
axios.defaults.proxy = { host: "127.0.0.1", port:8888}
axios.defaults.proxy = { host: "127.0.0.1", port:8888, protocol: "http"}
axios.post(url: <api>, {post:data}, {proxy: {host: "127.0.0.1", "8888"} });
Run Code Online (Sandbox Code Playgroud)
以及以上的许多不同变体。启用代理后,它将无法完成请求。
我正在努力掌握 c# async await 的基本概念。
基本上,我拥有的是一个我需要处理的对象列表,处理过程涉及遍历其属性并连接字符串,然后创建一个新对象(在这种情况下称为 trellocard)并最终添加一个 trellocard 列表。
迭代需要很长时间,所以我想做的是异步处理多个对象。
我尝试了多种方法,但基本上我想做这样的事情。(在下面的例子中,我已经删除了处理,只是把 system.threading.thread.sleep(200)。我等待这不是一个异步方法,我可以使用 tasks.delay 但重点是我的处理没有有任何异步方法,我只想用多个实例运行整个方法。
private async Task<List<TrelloCard>> ProcessJobs(IQueryable<IGrouping<CardGrouping, Job>> jobs)
{
List<TrelloCard> cards = new List<TrelloCard>();
foreach (var job in jobs.ToList())
{
card = await ProcessCards(job, cards); // I would like to run multiple instances of the processing
cards.add(card); //Once each instance is finshed it adds it to the list
}
private async Task<TrelloCard> ProcessCards(Job job)
{
System.Threading.Thread.Sleep(2000); //Just for examples sake
return new TrelloCard();
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 Create-React-App 学习 React Redux
我在存储、减速器、动作等的逻辑上遇到了问题。
我有一个简单的登录页面(省略了一些 JSX 以使其更易于阅读)
登录.js
import React, { Component } from "react";
import { connect } from "react-redux";
import * as actions from '../../actions';
import Logo from "../img/image-center.png";
import "./login.css";
class Login extends Component {
constructor(props){
super(props);
this.state = {
errorMsg : ""
};
this.loginClicked = this.loginClicked.bind(this);
console.log("loggedIn:", this.props.login);
}
loginClicked() {
try {
this.props.loginUser(this.refs.email.value, this.refs.password.value)
.then(() => {
console.log("thisprops", this.props);
});
}
catch(ex){
this.state.errorMsg = "Unable to connect to server";
console.log("error", ex);
}
} …Run Code Online (Sandbox Code Playgroud) 我正在慢慢自学 NodeJs、Express、React、monogoDB 和 Typescript ..(来自 MVC C# SQL DB 背景)
我的非常简单的 Hello world 程序只需要与 Express 服务器通信以显示用户列表。我的 Express 服务器在端口 3001 上,而我的 Create-React-App 前端在端口 3000 上。
我的应用程序组件如下:
import * as React from 'react';
import './App.css';
const logo = require('./logo.svg');
class App extends React.Component {
state = {users: []}
componentDidMount(){
console.log("Fetching Users");
fetch('/users')
.then(res=> res.json())
.then(users=> this.setState({users}));
}
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React test</h2>
{this.state.users.map(user =>
<div key={user.id}>{user.username}</div>
)}
</div> …Run Code Online (Sandbox Code Playgroud) c# ×5
asp.net-core ×2
async-await ×2
javascript ×2
node.js ×2
reactjs ×2
ajax ×1
asp.net ×1
asp.net-mvc ×1
asynchronous ×1
axios ×1
email ×1
fiddler ×1
gmail ×1
html ×1
jquery ×1
react-redux ×1
redux-thunk ×1
typescript ×1
wia ×1