Last active
October 28, 2015 20:00
-
-
Save DrMabuse23/a85b8cbc5355b1ad39fb to your computer and use it in GitHub Desktop.
Menu class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import React from 'react'; | |
import { Router, Route, Link } from 'react-router' | |
import shell from 'shell'; | |
import fs from 'fs'; | |
import ipc from 'ipc'; | |
export class Main extends React.Component { | |
state = { | |
message: 'Hello, Electron' | |
} | |
constructor () { | |
super(); | |
} | |
componentWillMount(){ | |
ipc.on('open-files', (event, files) => { | |
console.log(files); | |
}); | |
} | |
render() { | |
return ( | |
<div className="container"> | |
<div className="jumbotron main"> | |
<h1>{this.state.message}</h1> | |
<img src="../assets/images/electron.svg" alt="" width="128px"></img> | |
</div> | |
</div> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ipc from 'ipc'; | |
import dialog from 'dialog'; | |
export default class OpenFile { | |
constructor() { | |
this.files = []; | |
} | |
openFolder() { | |
var self = this; | |
dialog.showOpenDialog({ properties: ['openDirectory'] }, (resp) => { | |
self.files = resp; | |
ipc.send('open-folder', self.files); | |
console.log(self.files); | |
}); | |
} | |
openFiles() { | |
var self = this; | |
dialog.showOpenDialog( | |
{ | |
properties: ['openFile', 'multiSelections'], | |
filters: [ | |
{ name: 'Json', extensions: ['json'] } | |
] | |
}, | |
(resp) => { | |
self.files = resp; | |
console.log(self.files); | |
ipc.send('open-files', self.files); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment