Exemple #1
0
 public ActionSheetPopupViewModel(ActionSheetModel model)
 {
     Title        = model.Title;
     ButtonLabels = model.Buttons.ToList();
     CancelLabel  = model.Cancel;
     ContentType  = model.ContentType;
 }
            private string ContentTypeToString(eContentType Type)
            {
                switch (Type)
                {
                case eContentType.CONTENTS_TEXT_PLAIN:
                    return("text/plaie");

                case eContentType.CONTENTS_ARCHIVE_ZIP:
                    return("application/zip");
                }

                return(System.String.Empty);
            }
Exemple #3
0
        public string createRequestOrResponseXMLInFolder(string fileType, string fileContent, eContentType CT)
        {
            String fileName  = "";
            String timeStamp = DateTime.Now.ToString("dd_MM_yyyy_HH_mm_ss_fff");

            fileName += this.Description;
            fileName += "_" + fileType;
            fileName += "_" + timeStamp;


            string DirectoryPath = SaveRequestResponseFolderPath.ValueForDriver;

            if (DirectoryPath.StartsWith(@"~\"))
            {
                DirectoryPath = DirectoryPath.Replace(@"~\", SolutionFolder);
            }

            DirectoryPath += @"\" + fileType;
            if (!Directory.Exists(DirectoryPath))
            {
                Directory.CreateDirectory(DirectoryPath);
            }

            if (CT == eContentType.XML)
            {
                XmlDocument xmlDoc = new XmlDocument();

                xmlDoc.LoadXml(fileContent);
                //string xmlFilesDir = "";
                try
                {
                    //xmlFilesDir = SaveRequestResponseFolderPath.ValueForDriver.Replace(@"~\", SolutionFolder) + @"\" + fileType + "XMLs";
                    //if (!Directory.Exists(xmlFilesDir))
                    //    Directory.CreateDirectory(xmlFilesDir);
                    xmlDoc.Save(DirectoryPath + "\\" + fileName + ".xml");
                }
                catch (Exception e)
                {
                    System.Windows.MessageBox.Show(e.Message);
                }
            }
            else
            {
                if (CT == eContentType.JSon)
                {
                    fileName += ".json";
                }
                else
                {
                    fileName += ".txt";
                }
                //string getFolderPath = GetValueForDriverParam(Fields.SaveRequestResponseFolderPath);

                System.IO.File.WriteAllText(DirectoryPath + "\\" + fileName, fileContent);
            }

            return(fileName);
        }
Exemple #4
0
        public string createRequestOrResponseXMLInFolder(string fileType, string fileContent, eContentType CT)
        {
            string fileName      = string.Empty;
            string fileExtension = string.Empty;

            string DirectoryPath = CreateFolder(fileType);

            if (CT == eContentType.XML)
            {
                XmlDocument xmlDoc = new XmlDocument();

                xmlDoc.LoadXml(fileContent);

                try
                {
                    fileName = CreateFileName(fileType, "xml");
                    xmlDoc.Save(Path.Combine(DirectoryPath, fileName));
                }
                catch (Exception e)
                {
                    Reporter.ToUser(eUserMsgKey.FileOperationError, e.Message);
                }
            }
            else
            {
                if (CT == eContentType.JSon)

                {
                    fileExtension = "json";
                }

                else
                {
                    fileExtension = "txt";
                }

                fileName = CreateFileName(fileType, fileExtension);
                File.WriteAllText(Path.Combine(DirectoryPath, fileName), fileContent);
            }

            return(fileName);
        }
Exemple #5
0
        public async Task <string> DisplayActionSheetCustomAsync(string title, string cancel, eContentType contentType, params string[] buttons)
        {
            _action = string.Empty;
            _cancellationToken?.Cancel();
            _cancellationToken = new CancellationTokenSource();
            if (Device.RuntimePlatform == Device.iOS)
            {
                await Task.Delay(500);
            }

            try
            {
                Notify.SubscribeActionSheetPopup((sender) =>
                {
                    _action = sender.Arg;
                    WaitHandle.Set();
                });

                await SimpleIoc.Default.GetInstance <INavigationService>().PushPopupAsync(Locator.Popup.ActionSheetPopup,
                                                                                          new ActionSheetModel {
                    Title = title, Cancel = cancel, ContentType = contentType, Buttons = buttons
                }, false, _cancellationToken.Token);

                await Task.Run(() => WaitHandle.WaitOne());
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }

            return(_action);
        }
            public bool CreateObject(string ContainerName, string ObjectName, Stream Data, eContentType Type)
            {
                try {
                    this.m_Core.Logger?.WriteLine("Request the create object [" + ObjectName + "] in [" + ContainerName + "]");

                    ConoHa.CreateObject(ContainerName, Data, ObjectName, this.ContentTypeToString(Type));

                    // update container info.
                    ConoHa.CreateContainer(ContainerName);
                } catch (System.Exception ex) {
                    this.m_Core.Logger?.WriteLine(ex.Message, eLogLevel.ERROR);
                    return(false);
                }

                return(true);
            }
Exemple #7
0
        public bool CreateObject(string ContainerName, string ObjectName, Stream Data, eContentType Type)
        {
            ConoHa.CreateObject(ContainerName, Data, ObjectName, this.ContentTypeToString(Type));

            return(true);
        }