本文整理汇总了C#中AppContext类的典型用法代码示例。如果您正苦于以下问题:C# AppContext类的具体用法?C# AppContext怎么用?C# AppContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AppContext类属于命名空间,在下文中一共展示了AppContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReportForm
public ReportForm()
{
_db = new AppContext();
_fieldRepository = new InterpolatedFieldRepository(_db);
InitializeComponent();
}
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:7,代码来源:ReportForm.cs
示例2: Start
public void Start()
{
AppContext app = new AppContext();
app.AddObject<IMessageOutput>(this);
_comm = new CommunicationStarter(app);
_comm.Connect();
}
开发者ID:scrato,项目名称:IDD_Test,代码行数:7,代码来源:Program.cs
示例3: ManageCustomersForm
public ManageCustomersForm()
{
InitializeComponent();
_db = new AppContext();
_customerRepository = new CustomerRepository(_db);
_searchCustomer = new Repository.Models.Customer();
}
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:7,代码来源:ManageCustomersForm.cs
示例4: AppContext
public AppContext(string filepath)
{
Context = this;
if (Settings.Default.RecentFileList == null)
{
Settings.Default.RecentFileList = new StringCollection();
Settings.Default.Save();
}
var diagramForm = new DiagramForm();
MainForm = diagramForm;
diagramForm.Show();
if (string.IsNullOrEmpty(filepath))
{
LoadLastFile(diagramForm);
}
else
{
try
{
diagramForm.OpenFileByPath(filepath);
}
catch (Exception exception)
{
MessageBox.Show(string.Format("{0}:{1}{2}", DesignerResources.FileCouldntBeOpened, Environment.NewLine, exception.Message), DesignerResources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
diagramForm.Focus();
}
开发者ID:Bruhankovi4,项目名称:Emotyper,代码行数:30,代码来源:AppContext.cs
示例5: ReportLogoControl
public ReportLogoControl()
{
InitializeComponent();
_db = new AppContext();
_settingRepository = new ReportSettingRepository(_db);
}
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:7,代码来源:ReportLogoControl.cs
示例6: CreateDatabse
public static bool CreateDatabse()
{
try
{
if (!Directory.Exists(DatabaseDirectory))
{
Directory.CreateDirectory(DatabaseDirectory);
}
AppContext db = new AppContext();
db.Database.CreateIfNotExists();
if (db.Database.Exists())
{
Database.SetInitializer<AppContext>(new AppContextInitializer());
return true;
}
return false;
}
catch (Exception ex)
{
throw ex;
}
}
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:25,代码来源:Connection.cs
示例7: AuthenticateUser
public bool AuthenticateUser(string username, string password, UserTypeEnum userType)
{
LoggedUser = null;
UserType = null;
AppContext ctx = new AppContext();
switch (userType)
{
case UserTypeEnum.Administrator:
AdministratorRepository adminRepo = new AdministratorRepository(new AppContext());
LoggedUser = unitOfWork.AdminRepository.GetByUsername(username);
break;
case UserTypeEnum.Student:
StudentRepository studentRepo = new StudentRepository(new AppContext());
LoggedUser = unitOfWork.StudentRepository.GetByUsername(username);
break;
case UserTypeEnum.Teacher:
TeacherRepository teacherRepo = new TeacherRepository(new AppContext());
LoggedUser = unitOfWork.TeacherRepository.GetByUsername(username);
break;
}
if (LoggedUser != null)
{
if (PasswordHasher.Equals(password, LoggedUser.Salt, LoggedUser.Hash))
{
UserType = userType;
return true;
}
LoggedUser = null;
}
return false;
}
开发者ID:bobi95,项目名称:UniSystemMVC,代码行数:35,代码来源:AuthenticationService.cs
示例8: GetOne
public static MvcContext GetOne( IMember objOwner, int appId )
{
IWebContext webContext = MockWebContext.New( 1, "http://localhost/", new System.IO.StringWriter() );
MvcContext ctx = new MvcContext( webContext );
// route
Route route = new wojilu.Web.Mvc.Routes.Route();
route.setAppId( appId ); // 为了让生成的link链接中有appId,必须设置此项
ctx.utils.setRoute( route );
// viewer: 某些地方需要判断viewer
ViewerContext viewer = new ViewerContext();
viewer.obj = new User();
ctx.utils.setViewerContext( viewer );
// owner
OwnerContext owner = new OwnerContext();
owner.Id = objOwner.Id;
owner.obj = objOwner;
ctx.utils.setOwnerContext( owner );
// app
IAppContext app = new AppContext();
app.Id = appId;
app.obj = BlogApp.findById( appId );
app.setAppType( typeof( BlogApp ) ); // 如果要使用alang语言包,必须设置此项
ctx.utils.setAppContext( app );
return ctx;
}
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:31,代码来源:MockContext.cs
示例9: Setup
public void Setup()
{
using (FullInputContext inputcontext = new FullInputContext(""))
{
_appContext = new AppContext(TestConfig.GetConfig().GetRipleyServerPath());
_siteOptionList = new SiteOptionList();
_siteOptionList.CreateFromDatabase(inputcontext.ReaderCreator, inputcontext.dnaDiagnostics);
}
DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
request.SetCurrentUserNormal();
IInputContext inputContext = DnaMockery.CreateDatabaseInputContext();
using (IDnaDataReader dataReader = inputContext.CreateDnaDataReader(""))
{
SetSiteID(dataReader, "h2g2");
_includeContentFromOtherSites = _siteOptionList.GetValueBool(_siteId, "PersonalSpace", "IncludeContentFromOtherSites");
//Create a post on h2g2
SetForumID(dataReader);
request = new DnaTestURLRequest("h2g2");
request.SetCurrentUserNormal();
int id = request.CurrentUserID;
request.RequestPage("AddThread?subject=test&body=blahblah&post=1&skin=purexml&forum=" + Convert.ToString(_forumId));
//Create a post on have your say.
SetSiteID(dataReader, "haveyoursay");
SetForumID(dataReader);
request = new DnaTestURLRequest("haveyoursay");
request.SetCurrentUserNormal();
request.RequestPage("AddThread?subject=test&body=blahblah&post=1&skin=purexml&forum=" + Convert.ToString(_forumId));
}
}
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:33,代码来源:UserPageTests.cs
示例10: DeOpsMutex
public DeOpsMutex(AppContext context, string[] args)
{
try
{
string name = "DeOps" + Application.ProductVersion;
TheMutex = new Mutex(true, name, out First);
string objectName = "SingleInstanceProxy";
string objectUri = "ipc://" + name + "/" + objectName;
if (First)
{
IpcChannel = new IpcServerChannel(name);
ChannelServices.RegisterChannel(IpcChannel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(IpcObject), objectName, WellKnownObjectMode.Singleton);
IpcObject obj = new IpcObject();
obj.NewInstance += context.SecondInstanceStarted;
RemotingServices.Marshal(obj, objectName);
}
else
{
IpcChannel = new IpcClientChannel();
ChannelServices.RegisterChannel(IpcChannel, false);
IpcObject obj = Activator.GetObject(typeof(IpcObject), objectUri) as IpcObject;
obj.SignalNewInstance(args);
}
}
catch { }
}
开发者ID:RoelofSol,项目名称:DeOps,代码行数:35,代码来源:Startup.cs
示例11: Login
public async Task<ActionResult> Login(LoginModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var appContext = new AppContext();
var user = await appContext.Users.Find(x => x.Email == model.Email).SingleOrDefaultAsync();
if (user == null)
{
ModelState.AddModelError("Email", "Email address has not been registered.");
return View(model);
}
var claims = new[]
{
new Claim(ClaimTypes.Name, user.Name),
new Claim(ClaimTypes.Email, user.Email)
};
var identity = new ClaimsIdentity(claims, "ApplicationCookie");
var context = Request.GetOwinContext();
var authManager = context.Authentication;
authManager.SignIn(identity);
return Redirect(GetRedirectUrl(model.ReturnUrl));
}
开发者ID:hperantunes,项目名称:simple-ideas-csharp,代码行数:29,代码来源:AccountController.cs
示例12: IgnoreFieldsControl
public IgnoreFieldsControl()
{
_db = new AppContext();
_preferenceRepository = new AppPreferencesRepository(_db);
InitializeComponent();
}
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:7,代码来源:IgnoreFieldsControl.cs
示例13: GetAvatar
public ActionResult GetAvatar(int size)
{
string uid = Session["currentUserId"].ToString();
AccountModel user = null;
byte[] avatar = null;
using (var db = new AppContext())
{
user = db.Accounts.Where(a => a.WeiboId == uid).ToList().First();
}
using (var client = new WebClient())
{
switch (size)
{
case 50:
avatar = client.DownloadData(user.Avatar50Url);
break;
case 180:
default:
avatar = client.DownloadData(user.Avatar180Url);
break;
}
}
return File(avatar, "image/jpeg");
}
开发者ID:JasonSun,项目名称:Lookback,代码行数:27,代码来源:AccountController.cs
示例14: RangeRulesControl
public RangeRulesControl()
{
_db = new AppContext();
_preferenceRepository = new AppPreferencesRepository(_db);
InitializeComponent();
}
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:7,代码来源:RangeRulesControl.cs
示例15: FileReaderForm
public FileReaderForm()
{
_db = new AppContext();
_preferenceRepository = new AppPreferencesRepository(_db);
rangeList = _preferenceRepository.GetFieldRangeList();
InitializeComponent();
}
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:7,代码来源:FileReaderForm.cs
示例16: GetOne
public static MvcContext GetOne( IMember objOwner )
{
MvcContext ctx = getContextInit();
// route
Route route = new wojilu.Web.Mvc.Routes.Route();
ctx.utils.setRoute( route );
// viewer: 某些地方需要判断viewer
ViewerContext viewer = new ViewerContext();
viewer.obj = new User();
ctx.utils.setViewerContext( viewer );
// owner
OwnerContext owner = new OwnerContext();
owner.Id = objOwner.Id;
owner.obj = objOwner;
ctx.utils.setOwnerContext( owner );
// app
IAppContext app = new AppContext();
app.obj = null;
ctx.utils.setAppContext( app );
return ctx;
}
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:26,代码来源:MockContext.cs
示例17: Main
public static int Main(string[] args)
{
const string outputPath = @"C:\Users\buzakovpa\YandexDisk\databases\oil-screens";
var inputPath = @"C:\Users\buzakovpa\YandexDisk\databases\oil-result\";
using (var context = new AppContext()) {
var import = new MakesImport(context);
var files = Directory
.GetFiles(outputPath, "*.json", SearchOption.AllDirectories)
.ToList();
files.ForEach(
a => {
var fn = Path.GetFileName(a);
var file0Info = new FileInfo(a);
var file1Info = new FileInfo(inputPath + fn);
if (File.Exists(inputPath + fn) && file0Info.Length != file1Info.Length) {
inputPath += new Random().Next(100000, 999999);
}
File.Move(a, inputPath + fn);
});
}
return 0;
}
开发者ID:buzakovpa,项目名称:ccpublic,代码行数:28,代码来源:Program.cs
示例18: Authenticate
public bool Authenticate(String username, String password)
{
using (var ctx = new AppContext())
{
return ctx.Users.Any(u => u.Username == username && u.Password == password);
}
}
开发者ID:rmariuzzo,项目名称:JW-Service-Report,代码行数:7,代码来源:UserService.cs
示例19: ShowControl
/// <summary>
/// Shows control
/// </summary>
/// <param name="context"></param>
public override void ShowControl(AppContext context)
{
base.ShowControl(context);
if (!IsInitialized)
{
ComponentConfigElement element = context.ScopeNode.Tag as ComponentConfigElement;
if (element != null)
{
txtApplication.Text = element.GetStringSetting("ApplicationName");
txtComponent.Text = element.GetStringSetting("ComponentName");
txtVersion.Text = element.GetStringSetting("Release");
lblDescription.Text = element.GetStringSetting("ComponentDescription");
string installer = element.GetStringSetting("Installer");
string path = element.GetStringSetting("InstallerPath");
string type = element.GetStringSetting("InstallerType");
if ( string.IsNullOrEmpty(installer) ||
string.IsNullOrEmpty(path) ||
string.IsNullOrEmpty(type))
{
btnRemove.Enabled = false;
btnSettings.Enabled = false;
}
}
IsInitialized = true;
}
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:31,代码来源:ComponentControl.cs
示例20: ManageCustomerFarmsForm
public ManageCustomerFarmsForm()
{
InitializeComponent();
_db = new AppContext();
_customerRepository = new CustomerRepository(_db);
_farmRepository = new CustomerFarmRepository(_db);
}
开发者ID:shoaib-ijaz,项目名称:geosoft,代码行数:7,代码来源:ManageCustomerFarmsForm.cs
注:本文中的AppContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论