[{
"name": "SiO2",
"h": 906,
"s": -477,
"a": 44,
"b": 67,
"c": 47
},
{
"name": "Al2O3",
"h": 805,
"s": -155,
"a": 53,
"b": 73,
"c": 62
}
]
using (FileStream fs = new FileStream("db1.json", FileMode.OpenOrCreate))
{
CompoundProps propss = JsonSerializer.Deserialize<CompoundProps[]>(fs.ReadToEnd());
var props = propss[0];
Console.WriteLine($"Name: {props.name} H: {props.h} S: {props.s} a: {props.a} b: {props.b} c: {props.c}");
}
// vue.config.js
var path = require('path')
const PrerenderSPAPlugin = require('prerender-spa-plugin')
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\assets\/.*.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new BundleAnalyzerPlugin(),
new PrerenderSPAPlugin({
// Required - The path to the webpack-outputted app to prerender.
staticDir: path.join(__dirname, 'dist'),
// Optional - The path your rendered app should be output to.
// (Defaults to staticDir.)
outputDir: path.join(__dirname, 'prerendered'),
// Optional - The location of index.html
indexPath: path.join(__dirname, 'dist', 'index.html'),
// Required - Routes to render.
routes: ['/', '/about'],
// Optional - Allows you to customize the HTML and output path before
// writing the rendered contents to a file.
// renderedRoute can be modified and it or an equivelant should be returned.
// renderedRoute format:
// {
// route: String, // Where the output file will end up (relative to outputDir)
// originalRoute: String, // The route that was passed into the renderer, before redirects.
// html: String, // The rendered HTML for this route.
// outputPath: String // The path the rendered HTML will be written to.
// }
postProcess(renderedRoute) {
// Ignore any redirects.
renderedRoute.route = renderedRoute.originalRoute;
// Basic whitespace removal. (Don't use this in production.)
renderedRoute.html = renderedRoute.html.split(/>[\s]+</gmi).join('><')
// Remove /index.html from the output path if the dir name ends with a .html file extension.
// For example: /dist/dir/special.html/index.html -> /dist/dir/special.html
if (renderedRoute.route.endsWith('.html')) {
renderedRoute.outputPath = path.join(__dirname, 'dist', renderedRoute.route);
}
return renderedRoute;
},
// Optional - Uses html-minifier (https://github.com/kangax/html-minifier)
// To minify the resulting HTML.
// Option reference: https://github.com/kangax/html-minifier#options-quick-reference
minify: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
decodeEntities: true,
keepClosingSlash: true,
sortAttributes: true
},
// Server configuration options.
server: {
// Normally a free port is autodetected, but feel free to set this if needed.
port: 8001
},
// The actual renderer to use. (Feel free to write your own)
// Available renderers: https://github.com/Tribex/prerenderer/tree/master/renderers
renderer: new Renderer({
// Optional - The name of the property to add to the window object with the contents of `inject`.
// injectProperty: '__PRERENDER_INJECTED',
// Optional - Any values you'd like your app to have access to via `window.injectProperty`.
// inject: {
// foo: 'bar'
// },
// Optional - defaults to 0, no limit.
// Routes are rendered asynchronously.
// Use this to limit the number of routes rendered in parallel.
maxConcurrentRoutes: 4,
// Optional - Wait to render until the specified event is dispatched on the document.
// eg, with `document.dispatchEvent(new Event('custom-render-trigger'))`
// renderAfterDocumentEvent: 'custom-render-trigger',
// Optional - Wait to render until the specified element is detected using `document.querySelector`
// renderAfterElementExists: 'my-app-element',
// Optional - Wait to render until a certain amount of time has passed.
// NOT RECOMMENDED
// renderAfterTime: 5000, // Wait 5 seconds.
// Other puppeteer options.
// (See here: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions)
headless: true // было false Display the browser window when rendering. Useful for debugging.
})
})
]
}
}
using System.Collections.Generic;
namespace TreeViewBinding.Code
{
public class TreeSource
{
public TreeSource()
{
Leaves = new List<TreeLeaf>();
}
public List<TreeLeaf> Leaves { get; set; }
/// <summary>
/// Load data stub. In this example use mock data. In real application load data from database or web service
/// </summary>
public void LoadData()
{
var first = new TreeLeaf { Description = "First description", Title = "First" };
var firstSubs = new[]
{
new TreeLeaf(first){Description = "First desc",Title = "First"},
new TreeLeaf(first){Description = "Second desc",Title = "Second"},
new TreeLeaf(first){Description = "Third desc",Title = "Third"}
};
first.Leaves.AddRange(firstSubs);
var second = new TreeLeaf { Description = "Second description", Title = "Second" };
var third = new TreeLeaf { Description = "Third description", Title = "Third" };
Leaves.AddRange(new[]
{
first,
second,
third,
});
}
}
}
using System.Collections.Generic;
namespace TreeViewBinding.Code
{
public class TreeLeaf
{
public TreeLeaf(TreeLeaf parent = null)
{
Leaves = new List<TreeLeaf>();
Parent = parent;
}
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Icon { get; set; }
public List<TreeLeaf> Leaves { get; private set; }
public TreeLeaf Parent { get; private set; }
}
}
#region License
// // Разработано: Коротенко Владимиром Николаевичем (Vladimir N. Korotenko)
// // email: koroten@ya.ru
// // skype:vladimir-korotenko
// // https://vkorotenko.ru
// // Создано: 09.05.2020 8:26
#endregion
using System.Collections.Generic;
using System.Windows.Forms;
using TreeViewBinding.Code;
namespace TreeViewBinding
{
public partial class TreeViewBindingForm : Form
{
private TreeSource _treeSource;
private TreeLeaf _currentLeaf;
private TreeNode _node;
public TreeViewBindingForm()
{
InitializeComponent();
_treeSource = new TreeSource();
_treeSource.LoadData();
FillInTree(treeView.Nodes, _treeSource.Leaves);
}
private static void FillInTree(TreeNodeCollection nodes, IEnumerable<TreeLeaf> leafs)
{
foreach (var leaf in leafs)
{
var treeNode = new TreeNode(leaf.Title) {Tag = leaf};
nodes.Add(treeNode);
if (leaf.Leaves.Count > 0) FillInTree(treeNode.Nodes, leaf.Leaves);
}
}
private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Node.Tag is TreeLeaf item)
{
_node = e.Node;
_currentLeaf = item;
titleTextBox.Text = item.Title;
descriptionTexBox.Text = item.Description;
}
}
private void titleTextBox_TextChanged(object sender, System.EventArgs e)
{
if (_node != null)
{
_currentLeaf.Title = _node.Text = titleTextBox.Text;
}
}
private void descriptionTexBox_TextChanged(object sender, System.EventArgs e)
{
if (_node != null)
{
_currentLeaf.Description = descriptionTexBox.Text;
}
}
}
}
public class DataContext
{
private static readonly object Lock = new object();
private static DataContext _ctx;
private static SQLiteAsyncConnection _database;
private static SQLiteAsyncConnection _userDatabase;
public static DataContext Instance
{
get
{
lock (Lock)
{
if (_ctx != null) return _ctx;
var filePathOnPlatform = GetFilePathOnPlatform(Settings.DataBaseName);
var userDb = GetFilePathOnPlatform(Settings.UserDatabaseName);
_ctx = new DataContext(filePathOnPlatform, userDb);
return _ctx;
}
}
}
}