Example #1
0
        public Serializer()
        {
            const string APPLICATION_NAME        = "Drawing";
            const string CLIENT_SECRET_FILE_NAME = "..//..//clientSecret.json";

            _service = new GoogleDriveService(APPLICATION_NAME, CLIENT_SECRET_FILE_NAME);
        }
Example #2
0
 public Form()
 {
     #region initialization
     InitializeComponent();
     // prepare canvas
     _canvas.Dock           = DockStyle.Fill;
     _canvas.BackColor      = Color.CornflowerBlue;
     _canvas.MouseDown     += HandleCanvasPressed;
     _canvas.MouseUp       += HandleCanvasReleased;
     _canvas.MouseMove     += HandleCanvasMoved;
     _canvas.Paint         += HandleCanvasPaint;
     _canvas.AccessibleName = CANVAS;
     Controls.Add(_canvas);
     // prepare clear button
     _clear.AutoSize     = true;
     _clear.AutoSizeMode = AutoSizeMode.GrowAndShrink;
     // prepare presentation model and model
     _model                = new Model();
     _presentationModel    = new PresentationModel.PresentationModel(_model);
     _model._modelChanged += HandleModelChanged;
     // prepare state
     _drawingState       = new DrawingState(_model);
     _pointerState       = new PointerState(_model);
     _model.CurrentState = _pointerState;
     // prepare buttons
     _shapeButtons = new List <Button>();
     _shapeButtons.Add(_rectangle);
     _shapeButtons.Add(_line);
     _shapeButtons.Add(_hexagon);
     // google drive
     const String APPLICATION_NAME        = "DrawPicture";
     const String CLIENT_SECRET_FILE_NAME = "clientSecret.json";
     _uploadFileOpenFileDialog                  = new OpenFileDialog();
     _downloadFolderBrowserDialog               = new FolderBrowserDialog();
     _uploadFileOpenFileDialog.FileName         = "";
     _uploadFileOpenFileDialog.InitialDirectory = Directory.GetCurrentDirectory();
     _downloadFolderBrowserDialog.SelectedPath  = Directory.GetCurrentDirectory();
     _service = new GoogleDriveService(APPLICATION_NAME, CLIENT_SECRET_FILE_NAME);
     #endregion
 }
        public Form1()
        {
            const string APPLICATION_NAME        = "DrawAnywhere";
            const string CLIENT_SECRET_FILE_NAME = "clientSecret.json";
            const string PATH = "C:/Users/user/Desktop";

            InitializeComponent();
            //
            // prepare presentation model and model
            //
            _model                = new DrawingModel.Model();
            _presentationModel    = new PresentationModel.PresentationModel(_model, _panel);
            _model._modelChanged += HandleModelChanged;
            _service              = new GoogleDriveService(APPLICATION_NAME, CLIENT_SECRET_FILE_NAME);
            List <Google.Apis.Drive.v2.Data.File> fileList = _service.ListRootFileAndFolder();

            Google.Apis.Drive.v2.Data.File foundFile = fileList.Find(item => { return(item.Title == FILENAME); });
            int find = fileList.FindIndex(item => { return(item.Title == FILENAME); });

            if (find != -1)
            {
                _service.DownloadFile(foundFile, PATH);
            }
        }