Skip to content

Instantly share code, notes, and snippets.

@gsedubun
gsedubun / CRUDWPF.packages.config
Created Aug 24, 2018
packages config untu WPF CRUD
View CRUDWPF.packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net462" />
<package id="EntityFramework" version="6.2.0" targetFramework="net462" />
<package id="Prism.Core" version="6.3.0" targetFramework="net462" />
<package id="Prism.Unity" version="6.3.0" targetFramework="net462" />
<package id="Prism.Wpf" version="6.3.0" targetFramework="net462" />
<package id="SQLite.CodeFirst" version="1.5.1.25" targetFramework="net462" />
<package id="System.Data.SQLite" version="1.0.108.0" targetFramework="net462" />
<package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net462" />
View MapController.cs
using Microsoft.AspNetCore.Mvc;
using tracking.Models;
namespace tracking.Controllers
{
public class MapController : Controller{
private AirportRepository Repository;
public MapController(AirportRepository airport)
{
View osm_startup.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
View MappIndex.cshtml
@{
ViewData["Title"] = "Map";
}
<h2>@ViewData["Title"]</h2>
@section HeadScripts{
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.3/dist/leaflet.css"
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.3.3/dist/leaflet.js"
View AirportRepository.cs
using System.Collections.Generic;
using System.Data.SqlClient;
using Dapper;
namespace tracking.Models
{
public class AirportRepository{
// change the user id and password accordingly.
private const string connstring = "Data Source=.\\sqlexpress;Initial Catalog=OSM_DB;user id=[id]; password=[password]";
private SqlConnection Connection;
View chat_Startup.cs
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
///
/// sesuai bawaan template project
///
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, d =>
View Chat.cshtml
@{
ViewData["Title"] = "Chat";
}
<h2>Chat</h2>
<div class="container">
<form id="send-form" action="#">
<div class="form-group">
<label>Send a message:</label>
<div class="input-group">
@gsedubun
gsedubun / ChatHub.cs
Last active Jun 26, 2018
simple SignalR chat hub
View ChatHub.cs
public class ChatHub : Hub
{
public void Send(string message)
{
Clients.All.SendAsync("SendMessage", Context.User.Identity.Name, message);
}
public override async Task OnConnectedAsync(){
await Clients.All.SendAsync("SendAction", Context.User.Identity.Name, "joined");
}
View ViewAViewModel.cs
public class ViewAViewModel : BindableBase
{
private NewsService NewsService;
private NewsAnnouncement newsAnnouncement;
public NewsAnnouncement NewsAnnouncement
{
get { return newsAnnouncement; }
set
{
@gsedubun
gsedubun / ViewA.xaml
Last active May 22, 2018
ViewA.xaml is a view to display the announcement list and details of the selected announcement.
View ViewA.xaml
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*" MaxHeight="200" ScrollViewer.VerticalScrollBarVisibility="Auto"/>
<RowDefinition Height="2*" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"/>
</Grid.RowDefinitions>