protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ViewModel = new SelectedItemsPropertiesViewModel();
            var np = e.Parameter as Properties.PropertyNavParam;

            if (np.navParameter is ListedItem)
            {
                var listedItem = np.navParameter as ListedItem;
                if (listedItem.PrimaryItemAttribute == StorageItemTypes.File)
                {
                    BaseProperties = new FileProperties(ViewModel, np.tokenSource, Dispatcher, ItemMD5HashProgress, listedItem);
                }
                else if (listedItem.PrimaryItemAttribute == StorageItemTypes.Folder)
                {
                    BaseProperties = new FolderProperties(ViewModel, np.tokenSource, Dispatcher, listedItem);
                }
            }
            else if (np.navParameter is List <ListedItem> )
            {
                BaseProperties = new CombinedProperties(ViewModel, np.tokenSource, Dispatcher, np.navParameter as List <ListedItem>);
            }
            else if (np.navParameter is DriveItem)
            {
                BaseProperties = new DriveProperties(ViewModel, np.navParameter as DriveItem);
            }

            base.OnNavigatedTo(e);
        }
        public static void getCsvFilesList(TreeNodeMouseClickEventArgs e)
        {
            e.Node.Nodes.Clear();
            string vCurrFolderName = e.Node.Text;

            FolderProperties vCurrFolder = In2SqlSvcCsv.vFolderList.Find(item => item.FolderName == vCurrFolderName);

            try
            {
                /* e.Node.SelectedImageIndex = 22;
                 * e.Node.Tag = "CSV#";
                 * TreeNode vNodeTableFolder = new TreeNode("Tables".ToString(), 3, 3);
                 * vNodeTableFolder.Tag = vCurrFolder.FolderName + "_csv";
                 * e.Node.Nodes.Add(vNodeTableFolder);
                 */
                initCsvObjects(ref vCurrFolder);

                foreach (var vCurrFile in vCurrFolder.Files)
                {
                    TreeNode vNodeTable = new TreeNode(vCurrFile.Name, 22, 22);
                    vNodeTable.Tag = vCurrFolder.FolderName + "|" + vCurrFile.Name + "|$FILE_CSV$";
                    e.Node.Nodes.Add(vNodeTable);
                    TreeNode vNodeColumnTbl = new TreeNode(" ".ToString(), 99, 99);
                    vNodeColumnTbl.Tag = vCurrFolder.FolderName + "." + vCurrFile.Name;
                    vNodeTable.Nodes.Add(vNodeColumnTbl);
                }

                return;
            }
            catch (Exception er)
            {
                In2SqlSvcTool.ExpHandler(er, "getCsvFilesList 1 ");
            }
        }
Exemple #3
0
        private void InitializeFolderPluginUI(object sender)
        {
            FolderType selectedFolderType;

            if (sender == this.comboFolderType)
            {
                selectedFolderType = SelectedFolderType;
            }
            else
            {
                selectedFolderType = ((IFolderPropertiesUIPlugin)sender).FolderType;
            }

            IFolderPropertiesUIPlugin clientUIPlugin = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetFolderPropetiesPlugin(selectedFolderType);

            var allWorkersInfo = new FolderProperties();
            var allWorkers     = ClientRequests.GetAllWorkers();

            foreach (string info in allWorkers)
            {
                allWorkersInfo.Properties.Add(info, info);
            }

            clientUIPlugin.FolderProperties = allWorkersInfo;
            clientUIPlugin.OnLoad(ServiceProvider);

            clientUIPlugin.ChangedFolderTypePlugin += new EventHandler(FolderTypeIsChange);

            clientUIPlugin.FolderType.Id                = selectedFolderType.Id;
            clientUIPlugin.FolderType.Name              = selectedFolderType.Name;
            clientUIPlugin.FolderType.TypeClientUI      = selectedFolderType.TypeClientUI;
            clientUIPlugin.FolderType.TypeFolderService = selectedFolderType.TypeFolderService;

            Control newControl = (Control)clientUIPlugin;

            newControl.Location = new Point(0, 0);

            _newButtonsControl.Location = new Point(0, newControl.Size.Height);

            int width = Math.Max(Math.Max(BaseSize.X, newControl.Width), _newButtonsControl.Size.Width);

            this.Size = new Size(width, Math.Max(BaseSize.Y, newControl.Size.Height + _newButtonsControl.Location.Y + _newButtonsControl.Size.Height));

            this.Controls.Clear();
            this.Controls.Add(newControl);
            this.Controls.Add(_newButtonsControl);

            SelectedFolderType.Id   = selectedFolderType.Id;
            SelectedFolderType.Name = selectedFolderType.Name;
            SelectedFolderType.TypeFolderService = selectedFolderType.TypeFolderService;
            SelectedFolderType.TypeClientUI      = selectedFolderType.TypeClientUI;

            ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).CurrentFolderPropertiesPlugin = clientUIPlugin;
            ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedFolder.Name           = clientUIPlugin.FolderProperties.Name;
        }
Exemple #4
0
        private void CMBoxConnection_SelectedIndexChanged(object sender, EventArgs e)
        {
            vCurrConnection = CMBoxConnection.SelectedItem.ToString();
            ; //		SelectedItem

            CsvName.Text = vCurrConnection;

            FolderProperties vCurrFolderN = vFolderList.Find(item => item.FolderName == vCurrConnection);

            CsvPath.Text = vCurrFolderN.Path;
        }
Exemple #5
0
        void FolderTypeIsChange(object sender, EventArgs e)
        {
            FolderType selectedFolderType = SelectedFolderType;

            IFolderPropertiesUIPlugin clientUIPlugin = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetFolderPropetiesPlugin(SelectedFolderType);

            var allWorkersInfo = new FolderProperties();
            var allWorkers     = ClientRequests.GetAllWorkers();

            foreach (string info in allWorkers)
            {
                allWorkersInfo.Properties.Add(info, info);
            }

            clientUIPlugin.Info = allWorkersInfo;
            Control newControl = (Control)clientUIPlugin;

            int locationNewControlY = 0;

            foreach (Control control in BaseControls)
            {
                locationNewControlY = Math.Max(control.Location.Y + control.Size.Height, locationNewControlY);
            }

            newControl.Location = new Point(0, locationNewControlY);

            _newButtonsControl.Location = new Point(0, locationNewControlY + newControl.Size.Height);

            int width = Math.Max(Math.Max(BaseSizeHeight.X, newControl.Width), _newButtonsControl.Size.Width);

            this.Size = new Size(width, BaseSizeHeight.Y + newControl.Size.Height + _newButtonsControl.Size.Height);

            this.Controls.Clear();
            this.Controls.Add(newControl);
            this.Controls.Add(_newButtonsControl);

            foreach (Control control in BaseControls)
            {
                this.Controls.Add(control);
            }

            SelectedFolderType = selectedFolderType;
        }
Exemple #6
0
        public static IEnumerable <FilesAndProperties> getCsvFileColumn(string vCurrFolderName, string vObjName)
        {
            FolderProperties vCurrFolderN = vFolderList.Find(item => item.FolderName == vCurrFolderName);

            FilesAndProperties vObject = new FilesAndProperties();

            vObject.ObjName    = vCurrFolderName + '.' + vObjName;
            vObject.objColumns = new List <string>();

            using (TextFieldParser csvReader = new TextFieldParser(vCurrFolderN.Path + "\\" + vObjName))
            {
                csvReader.SetDelimiters(new string[] { "," });
                csvReader.HasFieldsEnclosedInQuotes = true;
                string[] colFields = csvReader.ReadFields();
                foreach (string column in colFields)
                {
                    vObject.objColumns.Add(column.ToString().Replace('"', ' ').Trim());
                }
            }

            yield return(vObject);
        }
        /// <summary>
        /// Populates a structure that contains 
        /// this known folder's properties.
        /// </summary>
        private void GetFolderProperties()
        {
            SafeNativeMethods.NativeFolderDefinition nativeFolderDefinition;
            FolderProperties _definition = 
                new FolderProperties();

            this._knownFolder.GetFolderDefinition(
                out nativeFolderDefinition);

            try
            {
                _definition.category = nativeFolderDefinition.category;
                _definition.canonicalName =
                    Marshal.PtrToStringUni(nativeFolderDefinition.name);
                _definition.description =
                    Marshal.PtrToStringUni(nativeFolderDefinition.description);
                _definition.parentId = nativeFolderDefinition.parentId;
                _definition.relativePath =
                    Marshal.PtrToStringUni(nativeFolderDefinition.relativePath);
                _definition.parsingName =
                    Marshal.PtrToStringUni(nativeFolderDefinition.parsingName);
                _definition.tooltipResourceId =
                    Marshal.PtrToStringUni(nativeFolderDefinition.tooltip);
                _definition.localizedNameResourceId =
                    Marshal.PtrToStringUni(nativeFolderDefinition.localizedName);
                _definition.iconResourceId =
                    Marshal.PtrToStringUni(nativeFolderDefinition.icon);
                _definition.security =
                    Marshal.PtrToStringUni(nativeFolderDefinition.security);
                _definition.fileAttributes =
                    (System.IO.FileAttributes)nativeFolderDefinition.attributes;
                _definition.definitionOptions =
                    nativeFolderDefinition.definitionOptions;

                _definition.folderTypeId = 
                    nativeFolderDefinition.folderTypeId;

                _definition.folderType = FolderTypes.GetFolderType(
                    _definition.folderTypeId);

                bool? pathExists;

                _definition.path = GetPath(out pathExists);
                _definition.pathExists = pathExists;

                _definition.redirection = 
                    _knownFolder.GetRedirectionCapabilities();

                // Turn tooltip, localized name and icon resource IDs 
                // into the actual resources.
                _definition.tooltip = Helpers.GetStringResource(
                    _definition.tooltipResourceId);

                _definition.icon = Helpers.GetIcon(
                    _definition.iconResourceId);

                _definition.localizedName = Helpers.GetStringResource(
                    _definition.localizedNameResourceId);

                _definition.folderId = _knownFolder.GetId();
                _definition.name = FolderIdentifiers.NameForGuid(
                    _definition.folderId);

                if (_definition.parentId != Guid.Empty)
                    _definition.parent = FolderIdentifiers.NameForGuid(
                        _definition.parentId);
                else
                    _definition.parent = String.Empty;

                properties = _definition;
            }
            finally
            {
                // Clean up memory. 
                Marshal.FreeCoTaskMem(nativeFolderDefinition.name);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.description);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.relativePath);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.parsingName);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.tooltip);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.localizedName);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.icon);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.security);
            }
        }
        /// <summary>
        /// Populates a structure that contains
        /// this known folder's properties.
        /// </summary>
        private void GetFolderProperties()
        {
            SafeNativeMethods.NativeFolderDefinition nativeFolderDefinition;
            FolderProperties _definition =
                new FolderProperties();

            this._knownFolder.GetFolderDefinition(
                out nativeFolderDefinition);

            try
            {
                _definition.category      = nativeFolderDefinition.category;
                _definition.canonicalName =
                    Marshal.PtrToStringUni(nativeFolderDefinition.name);
                _definition.description =
                    Marshal.PtrToStringUni(nativeFolderDefinition.description);
                _definition.parentId     = nativeFolderDefinition.parentId;
                _definition.relativePath =
                    Marshal.PtrToStringUni(nativeFolderDefinition.relativePath);
                _definition.parsingName =
                    Marshal.PtrToStringUni(nativeFolderDefinition.parsingName);
                _definition.tooltipResourceId =
                    Marshal.PtrToStringUni(nativeFolderDefinition.tooltip);
                _definition.localizedNameResourceId =
                    Marshal.PtrToStringUni(nativeFolderDefinition.localizedName);
                _definition.iconResourceId =
                    Marshal.PtrToStringUni(nativeFolderDefinition.icon);
                _definition.security =
                    Marshal.PtrToStringUni(nativeFolderDefinition.security);
                _definition.fileAttributes =
                    (System.IO.FileAttributes)nativeFolderDefinition.attributes;
                _definition.definitionOptions =
                    nativeFolderDefinition.definitionOptions;

                _definition.folderTypeId =
                    nativeFolderDefinition.folderTypeId;

                _definition.folderType = FolderTypes.GetFolderType(
                    _definition.folderTypeId);

                bool?pathExists;

                _definition.path       = GetPath(out pathExists);
                _definition.pathExists = pathExists;

                _definition.redirection =
                    _knownFolder.GetRedirectionCapabilities();

                // Turn tooltip, localized name and icon resource IDs
                // into the actual resources.
                _definition.tooltip = Helpers.GetStringResource(
                    _definition.tooltipResourceId);

                _definition.icon = Helpers.GetIcon(
                    _definition.iconResourceId);

                _definition.localizedName = Helpers.GetStringResource(
                    _definition.localizedNameResourceId);

                _definition.folderId = _knownFolder.GetId();
                _definition.name     = FolderIdentifiers.NameForGuid(
                    _definition.folderId);

                if (_definition.parentId != Guid.Empty)
                {
                    _definition.parent = FolderIdentifiers.NameForGuid(
                        _definition.parentId);
                }
                else
                {
                    _definition.parent = String.Empty;
                }

                properties = _definition;
            }
            finally
            {
                // Clean up memory.
                Marshal.FreeCoTaskMem(nativeFolderDefinition.name);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.description);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.relativePath);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.parsingName);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.tooltip);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.localizedName);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.icon);
                Marshal.FreeCoTaskMem(nativeFolderDefinition.security);
            }
        }
Exemple #9
0
 private void InitializeFolderTupeInfo()
 {
     _info = new FolderProperties();
 }
Exemple #10
0
        public static IEnumerable <CloudObjects> getFileList(string vCurrFolderName)
        {
            FolderProperties vCurrFolderN = vFolderList.Find(item => item.FolderName == vCurrFolderName);

            return(getFiesinFolderList(vCurrFolderN.Path));
        }
Exemple #11
0
        public static IEnumerable <FolderProperties> getCsvList()
        {
            RegistryKey vCurrRegKey = Registry.CurrentUser.OpenSubKey(@"Software\in2sql");
            string      vCurrName   = "";
            string      vPrevName   = "";

            if (vCurrRegKey != null)
            {
                FolderProperties vFolderProp = new FolderProperties();

                foreach (string name in vCurrRegKey.GetValueNames())
                {
                    if (name.Contains("Csv"))
                    {
                        string[] vNameDetails = name.Split('.');

                        if (vNameDetails.Count() < 2)
                        {
                            MessageBox.Show("Error in reading registry getCsvList ");
                            yield return(new FolderProperties());

                            break;
                        }
                        vCurrName = vNameDetails[1];

                        if (!vCurrName.Equals(vPrevName))
                        {
                            if (vPrevName.Length > 2)
                            {
                                yield return(vFolderProp);
                            }

                            vFolderProp = new FolderProperties();
                        }

                        vPrevName = vCurrName;

                        vFolderProp.FolderName = vCurrName;

                        string vCurrRegValue = in2SqlRegistry.getLocalRegValue(vCurrRegKey, name);

                        if (name.Contains("Path"))
                        {
                            vFolderProp.Path = vCurrRegValue;
                        }

                        if (vFolderProp.Path != null)
                        {
                            vPrevName = "";
                            yield return(vFolderProp);
                        }
                    }
                    else
                    {
                        if (vPrevName.Length > 2)
                        {
                            vPrevName = "";
                        }
                    }
                }
            }
        }
Exemple #12
0
        /// <summary>
        /// Propertie can be selected for a single object
        /// </summary>
        private void Properties(object sender, EventArgs e)
        {
            try
            {
                PiscesObject v = tree1.SelectedObject;

                if (v is Series)
                {
                    Series s = v as Series;
                    string tmpExp = s.Expression;
                    SeriesProperties p = new SeriesProperties(s, DB);
                    if (p.ShowDialog() == DialogResult.OK)
                    {
                        DB.SaveProperties(s);
                        if (s is CalculationSeries && tmpExp != s.Expression && s.Expression.Trim() != "")
                        {
                           // ShowAsBusy("calculating " + s.Expression);
                            //(s as CalculationSeries).Calculate();
                        }
                        //tree1_SelectionChanged(this, EventArgs.Empty);
                        DrawBasedOnTreeSelection();
                    }
                }
                else if (v is PiscesFolder)
                {
                    PiscesFolder f = v as PiscesFolder;
                    FolderProperties p = new FolderProperties(f);
                    if (p.ShowDialog() == DialogResult.OK)
                    {
                        DB.SaveProperties(f);
                    }
                }
            }
            catch (Exception propEx)
            {
                MessageBox.Show(propEx.Message);
            }
        }