예제 #1
0
        public bool CallMe(int iCallParamsBlock)
        {
            MainForm frm = new MainForm();

            KdSdkApi kdApi  = new KdSdkApiImpl(iCallParamsBlock);
            Scenes   scenes = new Scenes(frm, kdApi);
            ICollection <FigureOnBoard> facades;

            try
            {
                //MessageBox.Show("Before geting facades");
                facades = kdApi.getFacades();
                //MessageBox.Show("After geting facades");
            }
            catch (ArgumentNullException e)
            {
                MessageBox.Show("Объекты с атрибутом по свойству 1 не выбраны");
                return(false);
            }
            catch (Exception e)
            {
                MessageBox.Show("Something wrong in getting facades \n " + e.Message);
                return(false);
            }

            foreach (FigureOnBoard item in facades)
            {
                if (item.figure.width == 0 || item.figure.height == 0)
                {
                    MessageBox.Show("Element with id:" + item.figure + " have one or more zero parameters");
                }
                else
                {
                    if (((Facade)item.figure).getTextureId() != -1)
                    {
                        string path = kdApi.getImagePathFromTexture(((Facade)item.figure).getTextureId());
                        //MessageBox.Show(path);
                        if (!path.Equals(""))
                        {
                            Bitmap image = ImageConversion.getImage(path);
                            scenes.addFigure(new BkgImage(image), item.x, item.y);
                        }
                    }
                    scenes.addFigure(item.figure, item.x, item.y);
                }
            }
            //scenes.addFigure(new Facade(21, 100, 100), 0, 0);
            if (facades.Count < 1)
            {
                MessageBox.Show("Объекты с атрибутом по свойству 1 не выбраны");
                return(false);
            }
            frm.ShowDialog();

            return(true);
        }
예제 #2
0
        public bool OnPluginLoad(int iCallParamsBlock)
        {
            if (!verifyAccount())
            {
                return(false);
            }
            KdSdkApiImpl kdApi = new KdSdkApiImpl(iCallParamsBlock);

            //kdApi.updatePalitra();
            AddMenu(iCallParamsBlock);
            String path = StringResources.getResourcesPath() + "\\" + StringResources.getImageDirectoryName();

            //MessageBox.Show(path);
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            if (!File.Exists(path + "\\gray.jpg"))
            {
                ImageConversion.createBackgroundImage(path + "\\gray.jpg");
            }
            return(true);
        }