• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15
16import { Uri } from "vscode";
17import { H2hdfMod } from "../model/h2hdfmod";
18import { IModel } from "../model/imodel";
19import { H2hdfView } from "../view/h2hdfview";
20import { Logger } from "../common/log";
21import { IView } from "../view/iview";
22import { IController } from "./icontroller";
23import { EVENT_ERROR } from "../common/eventtype";
24
25export class H2hdfCtrl extends IController {
26  name: string;
27  view: IView;
28  model: IModel;
29  uri: Uri;
30  constructor(uri: Uri) {
31    super();
32    this.name = 'H2hdfCtrl';
33    this.model = H2hdfMod.getInstance();
34    this.view = new H2hdfView;
35    this.uri = uri;
36  }
37
38  public init(): void {
39    if (this.uri && this.uri.fsPath) {
40      this.view.init(this);
41      this.model.init(this.uri);
42      this.view.showProgress();
43    }
44  }
45
46  public start(): void {
47    try {
48      this.model.doStart();
49    } catch(e) {
50      let errmsg = this.name + " start error: " + JSON.stringify(e)
51      Logger.getInstance().error(errmsg);
52      this.view.showMsg(EVENT_ERROR, errmsg);
53    }
54  }
55
56  public stop(): void {
57    throw new Error("Method not implemented.");
58  }
59
60  public pause(): void {
61    throw new Error("Method not implemented.");
62  }
63
64  public resume(): void {
65    throw new Error("Method not implemented.");
66  }
67}